public function NumericComparator::accepts in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/sebastian/comparator/src/NumericComparator.php \SebastianBergmann\Comparator\NumericComparator::accepts()
Returns whether the comparator can compare two values.
Parameters
mixed $expected The first value to compare:
mixed $actual The second value to compare:
Return value
bool
Overrides ScalarComparator::accepts
1 method overrides NumericComparator::accepts()
- DoubleComparator::accepts in vendor/
sebastian/ comparator/ src/ DoubleComparator.php - Returns whether the comparator can compare two values.
File
- vendor/
sebastian/ comparator/ src/ NumericComparator.php, line 25
Class
- NumericComparator
- Compares numerical values for equality.
Namespace
SebastianBergmann\ComparatorCode
public function accepts($expected, $actual) {
// all numerical values, but not if one of them is a double
// or both of them are strings
return is_numeric($expected) && is_numeric($actual) && !(is_double($expected) || is_double($actual)) && !(is_string($expected) && is_string($actual));
}