File tree Expand file tree Collapse file tree
rules/CodeQuality/Rector/Equal Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments