Aggiornato Composer
This commit is contained in:
@@ -14,6 +14,8 @@ use function is_numeric;
|
||||
|
||||
/**
|
||||
* Compares doubles for equality.
|
||||
*
|
||||
* @deprecated since v3.0.5 and v4.0.8
|
||||
*/
|
||||
class DoubleComparator extends NumericComparator
|
||||
{
|
||||
|
||||
1
vendor/sebastian/comparator/src/Factory.php
vendored
1
vendor/sebastian/comparator/src/Factory.php
vendored
@@ -127,7 +127,6 @@ class Factory
|
||||
$this->registerDefaultComparator(new ObjectComparator);
|
||||
$this->registerDefaultComparator(new ResourceComparator);
|
||||
$this->registerDefaultComparator(new ArrayComparator);
|
||||
$this->registerDefaultComparator(new DoubleComparator);
|
||||
$this->registerDefaultComparator(new NumericComparator);
|
||||
$this->registerDefaultComparator(new ScalarComparator);
|
||||
$this->registerDefaultComparator(new TypeComparator);
|
||||
|
||||
@@ -32,10 +32,8 @@ class NumericComparator extends ScalarComparator
|
||||
*/
|
||||
public function accepts($expected, $actual)
|
||||
{
|
||||
// all numerical values, but not if one of them is a double
|
||||
// or both of them are strings
|
||||
// all numerical values, but not if both of them are strings
|
||||
return is_numeric($expected) && is_numeric($actual) &&
|
||||
!(is_float($expected) || is_float($actual)) &&
|
||||
!(is_string($expected) && is_string($actual));
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
namespace SebastianBergmann\Comparator;
|
||||
|
||||
use function is_bool;
|
||||
use function is_object;
|
||||
use function is_scalar;
|
||||
use function is_string;
|
||||
@@ -58,7 +59,7 @@ class ScalarComparator extends Comparator
|
||||
|
||||
// always compare as strings to avoid strange behaviour
|
||||
// otherwise 0 == 'Foobar'
|
||||
if (is_string($expected) || is_string($actual)) {
|
||||
if ((is_string($expected) && !is_bool($actual)) || (is_string($actual) && !is_bool($expected))) {
|
||||
$expectedToCompare = (string) $expectedToCompare;
|
||||
$actualToCompare = (string) $actualToCompare;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user