diff --git a/src/Comparator.php b/src/Comparator.php index eae8d6f..b6b57e6 100644 --- a/src/Comparator.php +++ b/src/Comparator.php @@ -130,7 +130,7 @@ public function hasFlag(int $flag): bool */ public function compare($value, $value2): bool { - if ($value === $value2 || (!$this->hasFlag(self::STRICT) && $value == $value2)) { + if ($value === $value2) { return true; } @@ -139,6 +139,16 @@ public function compare($value, $value2): bool if ($this->hasFlag(self::STRICT) && $type !== $type2) { return false; } + if ( + !$this->hasFlag(self::STRICT) + && $type === $type2 + && $type !== 'array' + && $value == $value2 + ) { + return true; + } + // TODO: fix non-strict comparation of non-compatible types (object with not object/string) + if ($type === 'double' || $type2 === 'double') { $type = 'float'; } elseif ($type === 'string' || $type2 === 'string') {