public function ScalarComparator::accepts in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/sebastian/comparator/src/ScalarComparator.php \SebastianBergmann\Comparator\ScalarComparator::accepts()
Returns whether the comparator can compare two values.
@since Method available since Release 3.6.0
Parameters
mixed $expected The first value to compare:
mixed $actual The second value to compare:
Return value
bool
Overrides Comparator::accepts
1 method overrides ScalarComparator::accepts()
- NumericComparator::accepts in vendor/
sebastian/ comparator/ src/ NumericComparator.php - Returns whether the comparator can compare two values.
File
- vendor/
sebastian/ comparator/ src/ ScalarComparator.php, line 26
Class
- ScalarComparator
- Compares scalar or NULL values for equality.
Namespace
SebastianBergmann\ComparatorCode
public function accepts($expected, $actual) {
return (is_scalar($expected) xor null === $expected) && (is_scalar($actual) xor null === $actual) || is_string($expected) && is_object($actual) && method_exists($actual, '__toString') || is_object($expected) && method_exists($expected, '__toString') && is_string($actual);
}