Skip to content

Commit 879e3c6

Browse files
committed
Fix
1 parent 9ded1cc commit 879e3c6

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

rules/CodeQuality/Rector/Equal/UseIdenticalOverEqualWithSameTypeRector.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function refactor(Node $node): ?Node
7474
$leftStaticType = $this->nodeTypeResolver->getNativeType($node->left);
7575
$rightStaticType = $this->nodeTypeResolver->getNativeType($node->right);
7676

77-
if ($this->shouldSkipCompareNumericString($leftStaticType, $rightStaticType)) {
77+
if ($this->shouldSkipCompareBoolToNumeric($leftStaticType, $rightStaticType)) {
7878
return null;
7979
}
8080

@@ -101,15 +101,15 @@ public function refactor(Node $node): ?Node
101101
return $this->processIdenticalOrNotIdentical($node);
102102
}
103103

104-
private function shouldSkipCompareNumericString(Type $leftStaticType, Type $rightStaticType): bool
104+
private function shouldSkipCompareBoolToNumeric(Type $leftStaticType, Type $rightStaticType): bool
105105
{
106106
// use ! ->no() as to support both yes and maybe
107107
if ($leftStaticType instanceof BooleanType) {
108-
return ! $rightStaticType->isNumericString()->no();
108+
return ! $rightStaticType->isNumericString()->no() || ! $rightStaticType->isInteger()->no() ;
109109
}
110110

111111
if ($rightStaticType instanceof BooleanType) {
112-
return ! $leftStaticType->isNumericString()->no();
112+
return ! $leftStaticType->isNumericString()->no() || ! $leftStaticType->isInteger()->no();
113113
}
114114

115115
return false;

0 commit comments

Comments
 (0)