Skip to content

Commit

Permalink
Update Comparator.php
Browse files Browse the repository at this point in the history
Signed-off-by: Anton <[email protected]>
  • Loading branch information
WinterSilence authored Aug 26, 2022
1 parent de266f9 commit 97b6552
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Comparator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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') {
Expand Down

0 comments on commit 97b6552

Please sign in to comment.