@@ -63,12 +63,12 @@ public function getRuleDefinition(): RuleDefinition
6363CODE_SAMPLE
6464 ,
6565 <<<'CODE_SAMPLE'
66- $json json_encode($content, 0 );
66+ $json = json_encode($content);
6767if (json_last_error() !== JSON_ERROR_NONE) {
6868 throw new \Exception(json_last_error_msg());
6969}
7070
71- $content = json_decode($json, null, 512, 0 );
71+ $content = json_decode($json, null, 512);
7272if (json_last_error() !== JSON_ERROR_NONE) {
7373 throw new \Exception(json_last_error_msg());
7474}
@@ -149,22 +149,26 @@ private function resolveFuncCall(Expression $Expression): ?FuncCall
149149 *
150150 * @return null|array<Expression|If_>
151151 */
152- private function refactorStmt (Expression $ Expression ): ?array
152+ private function refactorStmt (Expression $ expression ): ?array
153153 {
154- if ($ Expression ->getAttribute (AttributeKey::IS_IN_TRY_BLOCK ) === true ) {
154+ if ($ expression ->getAttribute (AttributeKey::IS_IN_TRY_BLOCK ) === true ) {
155155 return null ;
156156 }
157157
158158 // retrieve a `FuncCall`, if any, from the statement
159- $ funcCall = $ this ->resolveFuncCall ($ Expression );
159+ $ funcCall = $ this ->resolveFuncCall ($ expression );
160160
161161 // Nothing to do if no `FuncCall` found
162162 if (! $ funcCall instanceof FuncCall) {
163163 return null ;
164164 }
165165
166+ if ($ funcCall ->isFirstClassCallable ()) {
167+ return null ;
168+ }
169+
166170 // Nothing to do if not a refactored function
167- if (! in_array ( $ this ->getName ($ funcCall) , self ::REFACTOR_FUNCS , true )) {
171+ if (! $ this ->isNames ($ funcCall , self ::REFACTOR_FUNCS )) {
168172 return null ;
169173 }
170174
@@ -173,7 +177,7 @@ private function refactorStmt(Expression $Expression): ?array
173177 return null ;
174178 }
175179
176- $ nodes = [$ Expression ];
180+ $ nodes = [$ expression ];
177181 $ nodes [] = new If_ (
178182 new NotIdentical (
179183 new FuncCall (new Name ('json_last_error ' )),
0 commit comments