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 @@ -103,36 +103,31 @@ public function refactor(Node $node): ?Node
103103
104104 private function shouldSkipCompareBoolToNumeric (Type $ leftStaticType , Type $ rightStaticType ): bool
105105 {
106- // use ! ->no() as to verify both yes and maybe
107106 if ($ leftStaticType instanceof BooleanType) {
108- if (! $ rightStaticType ->isNumericString ()->no ()) {
109- return true ;
110- }
111-
112- if (! $ rightStaticType ->isInteger ()
113- ->no ()) {
114- return true ;
115- }
116-
117- return ! $ rightStaticType ->isFloat ()
118- ->no ();
107+ return $ this ->shouldSkipNumericType ($ rightStaticType );
119108 }
120109
121110 if ($ rightStaticType instanceof BooleanType) {
122- if (! $ leftStaticType ->isNumericString ()->no ()) {
123- return true ;
124- }
111+ return $ this ->shouldSkipNumericType ($ leftStaticType );
112+ }
125113
126- if (! $ leftStaticType ->isInteger ()
127- ->no ()) {
128- return true ;
129- }
114+ return false ;
115+ }
130116
131- return ! $ leftStaticType ->isFloat ()
132- ->no ();
117+ private function shouldSkipNumericType (Type $ type ): bool
118+ {
119+ // use ! ->no() as to verify both yes and maybe
120+ if (! $ type ->isNumericString ()->no ()) {
121+ return true ;
133122 }
134123
135- return false ;
124+ if (! $ type ->isInteger ()
125+ ->no ()) {
126+ return true ;
127+ }
128+
129+ return ! $ type ->isFloat ()
130+ ->no ();
136131 }
137132
138133 private function processIdenticalOrNotIdentical (Equal |NotEqual $ node ): Identical |NotIdentical
You can’t perform that action at this time.
0 commit comments