@@ -118,9 +118,9 @@ private function markConstantKnownInInnerStmts(If_ $if): void
118118 SimpleNodeTraverser::decorateWithAttributeValue ($ if , self ::PHP73_JSON_CONSTANT_IS_KNOWN , true );
119119 }
120120
121- private function resolveFuncCall (Expression $ Expression ): ?FuncCall
121+ private function resolveFuncCall (Expression $ expression ): ?FuncCall
122122 {
123- $ expr = $ Expression ->expr ;
123+ $ expr = $ expression ->expr ;
124124 if ($ expr instanceof Assign) {
125125 if ($ expr ->expr instanceof FuncCall) {
126126 return $ expr ->expr ;
@@ -154,8 +154,6 @@ private function refactorExpression(Expression $expression): ?array
154154
155155 // retrieve a `FuncCall`, if any, from the statement
156156 $ funcCall = $ this ->resolveFuncCall ($ expression );
157-
158- // Nothing to do if no `FuncCall` found
159157 if (! $ funcCall instanceof FuncCall) {
160158 return null ;
161159 }
@@ -165,12 +163,12 @@ private function refactorExpression(Expression $expression): ?array
165163 return null ;
166164 }
167165
168- if ($ funcCall ->isFirstClassCallable ()) {
166+ // Nothing to do if the flag `JSON_THROW_ON_ERROR` is not set in args
167+ if (! $ this ->hasConstFetchInArgs ($ funcCall ->getArgs (), 'JSON_THROW_ON_ERROR ' )) {
169168 return null ;
170169 }
171170
172- // Nothing to do if the flag `JSON_THROW_ON_ERROR` is not set in args
173- if (! $ this ->hasConstFetchInArgs ($ funcCall ->getArgs (), 'JSON_THROW_ON_ERROR ' )) {
171+ if ($ funcCall ->isFirstClassCallable ()) {
174172 return null ;
175173 }
176174
@@ -203,8 +201,7 @@ private function hasConstFetchInArgs(array $args, string $constName): bool
203201 {
204202 foreach ($ args as $ arg ) {
205203 $ value = $ arg ->value ;
206-
207- if ($ value instanceof ConstFetch && $ this ->getName ($ value ) === $ constName ) {
204+ if ($ value instanceof ConstFetch && $ this ->isName ($ value , $ constName )) {
208205 return true ;
209206 }
210207
0 commit comments