File tree Expand file tree Collapse file tree
rules/Transform/Rector/FuncCall Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -127,7 +127,10 @@ private function isWrappedFuncCall(StmtsAwareInterface $node): bool
127127 return false ;
128128 }
129129
130- $ phpVersionIdComparison = $ this ->getPhpVersionIdComparison ($ node ->cond );
130+ $ phpVersionId = $ this ->getPhpVersionId ($ node ->cond );
131+ if ($ phpVersionId === null ) {
132+ return false ;
133+ }
131134
132135 if (count ($ node ->stmts ) !== 1 ) {
133136 return false ;
@@ -142,7 +145,7 @@ private function isWrappedFuncCall(StmtsAwareInterface $node): bool
142145 foreach ($ this ->wrapFuncCallWithPhpVersionIdCheckers as $ wrapFuncCallWithPhpVersionIdChecker ) {
143146 if (
144147 $ this ->getName ($ childStmt ->expr ) !== $ wrapFuncCallWithPhpVersionIdChecker ->getFunctionName ()
145- || $ phpVersionIdComparison -> right ->value !== $ wrapFuncCallWithPhpVersionIdChecker ->getPhpVersionId ()
148+ || $ phpVersionId ->value !== $ wrapFuncCallWithPhpVersionIdChecker ->getPhpVersionId ()
146149 ) {
147150 continue ;
148151 }
@@ -153,10 +156,10 @@ private function isWrappedFuncCall(StmtsAwareInterface $node): bool
153156 return false ;
154157 }
155158
156- private function getPhpVersionIdComparison (Expr $ expr ): ?Smaller
159+ private function getPhpVersionId (Expr $ expr ): ?Int_
157160 {
158161 if ($ expr instanceof BooleanAnd) {
159- return $ this ->getPhpVersionIdComparison ($ expr ->left ) ?? $ this ->getPhpVersionIdComparison ($ expr ->right );
162+ return $ this ->getPhpVersionId ($ expr ->left ) ?? $ this ->getPhpVersionId ($ expr ->right );
160163 }
161164
162165 if (! $ expr instanceof Smaller) {
@@ -171,6 +174,6 @@ private function getPhpVersionIdComparison(Expr $expr): ?Smaller
171174 return null ;
172175 }
173176
174- return $ expr ;
177+ return $ expr-> right ;
175178 }
176179}
You can’t perform that action at this time.
0 commit comments