@@ -430,19 +430,17 @@ public static function findVariableScope(File $phpcsFile, $stackPtr, $varName =
430430
431431 $ enclosingScopeIndex = self ::findVariableScopeExceptArrowFunctions ($ phpcsFile , $ stackPtr );
432432
433- if (!is_null ($ enclosingScopeIndex )) {
434- $ arrowFunctionIndex = self ::getContainingArrowFunctionIndex ($ phpcsFile , $ stackPtr , $ enclosingScopeIndex );
435- $ isTokenInsideArrowFunctionBody = is_int ($ arrowFunctionIndex );
436- if ($ isTokenInsideArrowFunctionBody ) {
437- // Get the list of variables defined by the arrow function
438- // If this matches any of them, the scope is the arrow function,
439- // otherwise, it uses the enclosing scope.
440- if ($ arrowFunctionIndex ) {
441- $ variableNames = self ::getVariablesDefinedByArrowFunction ($ phpcsFile , $ arrowFunctionIndex );
442- self ::debug ('findVariableScope: looking for ' , $ varName , 'in arrow function variables ' , $ variableNames );
443- if (in_array ($ varName , $ variableNames , true )) {
444- return $ arrowFunctionIndex ;
445- }
433+ $ arrowFunctionIndex = self ::getContainingArrowFunctionIndex ($ phpcsFile , $ stackPtr , $ enclosingScopeIndex );
434+ $ isTokenInsideArrowFunctionBody = is_int ($ arrowFunctionIndex );
435+ if ($ isTokenInsideArrowFunctionBody ) {
436+ // Get the list of variables defined by the arrow function
437+ // If this matches any of them, the scope is the arrow function,
438+ // otherwise, it uses the enclosing scope.
439+ if ($ arrowFunctionIndex ) {
440+ $ variableNames = self ::getVariablesDefinedByArrowFunction ($ phpcsFile , $ arrowFunctionIndex );
441+ self ::debug ('findVariableScope: looking for ' , $ varName , 'in arrow function variables ' , $ variableNames );
442+ if (in_array ($ varName , $ variableNames , true )) {
443+ return $ arrowFunctionIndex ;
446444 }
447445 }
448446 }
0 commit comments