@@ -12,7 +12,7 @@ class Helpers {
1212  /** 
1313   * return int[] 
1414   */ 
15-   public  static  function  getEmptyTokens () {
15+   public  static  function  getPossibleEndOfFileTokens () {
1616    return  array_merge (
1717      array_values (Tokens::$ emptyTokens ),
1818      [
@@ -178,7 +178,7 @@ public static function getFunctionIndexForFunctionArgument(File $phpcsFile, $sta
178178      return  null ;
179179    }
180180
181-     $ nonFunctionTokenTypes  = self :: getEmptyTokens () ;
181+     $ nonFunctionTokenTypes  = Tokens:: $ emptyTokens  ;
182182    $ nonFunctionTokenTypes [] = T_STRING ;
183183    $ nonFunctionTokenTypes [] = T_BITWISE_AND ;
184184    $ functionPtr  = self ::getIntOrNull ($ phpcsFile ->findPrevious ($ nonFunctionTokenTypes , $ startOfArguments  - 1 , null , true , null , true ));
@@ -218,7 +218,7 @@ public static function isTokenInsideFunctionUseImport(File $phpcsFile, $stackPtr
218218  public  static  function  getUseIndexForUseImport (File   $ phpcsFile , $ stackPtr ) {
219219    $ tokens  = $ phpcsFile ->getTokens ();
220220
221-     $ nonUseTokenTypes  = self :: getEmptyTokens () ;
221+     $ nonUseTokenTypes  = Tokens:: $ emptyTokens  ;
222222    $ nonUseTokenTypes [] = T_VARIABLE ;
223223    $ nonUseTokenTypes [] = T_ELLIPSIS ;
224224    $ nonUseTokenTypes [] = T_COMMA ;
@@ -247,7 +247,7 @@ public static function findFunctionCall(File $phpcsFile, $stackPtr) {
247247    $ openPtr  = Helpers::findContainingOpeningBracket ($ phpcsFile , $ stackPtr );
248248    if  (is_int ($ openPtr )) {
249249      // First non-whitespace thing and see if it's a T_STRING function name 
250-       $ functionPtr  = $ phpcsFile ->findPrevious (self :: getEmptyTokens () , $ openPtr  - 1 , null , true , null , true );
250+       $ functionPtr  = $ phpcsFile ->findPrevious (Tokens:: $ emptyTokens  , $ openPtr  - 1 , null , true , null , true );
251251      if  (is_int ($ functionPtr ) && $ tokens [$ functionPtr ]['code ' ] === T_STRING ) {
252252        return  $ functionPtr ;
253253      }
@@ -274,7 +274,7 @@ public static function findFunctionCallArguments(File $phpcsFile, $stackPtr) {
274274    }
275275
276276    // $stackPtr is the function name, find our brackets after it 
277-     $ openPtr  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ stackPtr  + 1 , null , true , null , true );
277+     $ openPtr  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ stackPtr  + 1 , null , true , null , true );
278278    if  (($ openPtr  === false ) || ($ tokens [$ openPtr ]['code ' ] !== T_OPEN_PARENTHESIS )) {
279279        return  [];
280280    }
@@ -312,7 +312,7 @@ public static function getNextAssignPointer(File $phpcsFile, $stackPtr) {
312312    $ tokens  = $ phpcsFile ->getTokens ();
313313
314314    // Is the next non-whitespace an assignment? 
315-      $ nextPtr  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ stackPtr  + 1 , null , true , null , true );
315+      $ nextPtr  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ stackPtr  + 1 , null , true , null , true );
316316    if  (is_int ($ nextPtr )
317317      && isset (Tokens::$ assignmentTokens [$ tokens [$ nextPtr ]['code ' ]])
318318      // Ignore double arrow to prevent triggering on `foreach ( $array as $k => $v )`. 
@@ -540,14 +540,14 @@ public static function isArrowFunction(File $phpcsFile, $stackPtr) {
540540      return  false ;
541541    }
542542    // Make sure next non-space token is an open parenthesis 
543-     $ openParenIndex  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ stackPtr  + 1 , null , true );
543+     $ openParenIndex  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ stackPtr  + 1 , null , true );
544544    if  (! is_int ($ openParenIndex ) || $ tokens [$ openParenIndex ]['code ' ] !== T_OPEN_PARENTHESIS ) {
545545      return  false ;
546546    }
547547    // Find the associated close parenthesis 
548548    $ closeParenIndex  = $ tokens [$ openParenIndex ]['parenthesis_closer ' ];
549549    // Make sure the next token is a fat arrow 
550-     $ fatArrowIndex  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ closeParenIndex  + 1 , null , true );
550+     $ fatArrowIndex  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ closeParenIndex  + 1 , null , true );
551551    if  (! is_int ($ fatArrowIndex )) {
552552      return  false ;
553553    }
@@ -575,14 +575,14 @@ public static function getArrowFunctionOpenClose(File $phpcsFile, $stackPtr) {
575575      return  null ;
576576    }
577577    // Make sure next non-space token is an open parenthesis 
578-     $ openParenIndex  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ stackPtr  + 1 , null , true );
578+     $ openParenIndex  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ stackPtr  + 1 , null , true );
579579    if  (! is_int ($ openParenIndex ) || $ tokens [$ openParenIndex ]['code ' ] !== T_OPEN_PARENTHESIS ) {
580580      return  null ;
581581    }
582582    // Find the associated close parenthesis 
583583    $ closeParenIndex  = $ tokens [$ openParenIndex ]['parenthesis_closer ' ];
584584    // Make sure the next token is a fat arrow 
585-     $ fatArrowIndex  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ closeParenIndex  + 1 , null , true );
585+     $ fatArrowIndex  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ closeParenIndex  + 1 , null , true );
586586    if  (! is_int ($ fatArrowIndex )) {
587587      return  null ;
588588    }
@@ -632,7 +632,7 @@ public static function getListAssignments(File $phpcsFile, $listOpenerIndex) {
632632    }
633633
634634    // Find the assignment (equals sign) which, if this is a list assignment, should be the next non-space token 
635-     $ assignPtr  = $ phpcsFile ->findNext (self :: getEmptyTokens () , $ closePtr  + 1 , null , true );
635+     $ assignPtr  = $ phpcsFile ->findNext (Tokens:: $ emptyTokens  , $ closePtr  + 1 , null , true );
636636
637637    // If the next token isn't an assignment, check for nested brackets because we might be a nested assignment 
638638    if  (! is_int ($ assignPtr ) || $ tokens [$ assignPtr ]['code ' ] !== T_EQUAL ) {
@@ -747,8 +747,10 @@ public static function isVariableANumericVariable($varName) {
747747   */ 
748748  public  static  function  isVariableInsideElseCondition (File   $ phpcsFile , $ stackPtr ) {
749749    $ tokens  = $ phpcsFile ->getTokens ();
750-     $ nonFunctionTokenTypes  = self :: getEmptyTokens () ;
750+     $ nonFunctionTokenTypes  = Tokens:: $ emptyTokens  ;
751751    $ nonFunctionTokenTypes [] = T_OPEN_PARENTHESIS ;
752+     $ nonFunctionTokenTypes [] = T_INLINE_HTML ;
753+     $ nonFunctionTokenTypes [] = T_CLOSE_TAG ;
752754    $ nonFunctionTokenTypes [] = T_VARIABLE ;
753755    $ nonFunctionTokenTypes [] = T_ELLIPSIS ;
754756    $ nonFunctionTokenTypes [] = T_COMMA ;
@@ -869,7 +871,7 @@ public static function getScopeCloseForScopeOpen(File $phpcsFile, $scopeStartInd
869871  public  static  function  getLastNonEmptyTokenIndexInFile (File   $ phpcsFile ) {
870872    $ tokens  = $ phpcsFile ->getTokens ();
871873    foreach  (array_reverse ($ tokens , true ) as  $ index  => $ token ) {
872-       if  (! in_array ($ token ['code ' ], self ::getEmptyTokens (), true )) {
874+       if  (! in_array ($ token ['code ' ], self ::getPossibleEndOfFileTokens (), true )) {
873875        return  $ index ;
874876      }
875877    }
@@ -953,7 +955,7 @@ public static function getFunctionIndexForFunctionCallArgument(File $phpcsFile,
953955      return  null ;
954956    }
955957
956-     $ nonFunctionTokenTypes  = self :: getEmptyTokens () ;
958+     $ nonFunctionTokenTypes  = Tokens:: $ emptyTokens  ;
957959    $ functionPtr  = self ::getIntOrNull ($ phpcsFile ->findPrevious ($ nonFunctionTokenTypes , $ startOfArguments  - 1 , null , true , null , true ));
958960    if  (! is_int ($ functionPtr ) || ! isset ($ tokens [$ functionPtr ]['code ' ])) {
959961      return  null ;
@@ -997,7 +999,7 @@ public static function isVariableInsideIssetOrEmpty(File $phpcsFile, $stackPtr)
997999   */ 
9981000  public  static  function  isVariableArrayPushShortcut (File   $ phpcsFile , $ stackPtr ) {
9991001    $ tokens  = $ phpcsFile ->getTokens ();
1000-     $ nonFunctionTokenTypes  = self :: getEmptyTokens () ;
1002+     $ nonFunctionTokenTypes  = Tokens:: $ emptyTokens  ;
10011003
10021004    $ arrayPushOperatorIndex1  = self ::getIntOrNull ($ phpcsFile ->findNext ($ nonFunctionTokenTypes , $ stackPtr  + 1 , null , true , null , true ));
10031005    if  (! is_int ($ arrayPushOperatorIndex1 )) {
@@ -1095,7 +1097,7 @@ public static function isTokenInsideAssignmentLHS(File $phpcsFile, $stackPtr) {
10951097  public  static  function  isTokenVariableVariable (File   $ phpcsFile , $ stackPtr ) {
10961098    $ tokens  = $ phpcsFile ->getTokens ();
10971099
1098-     $ prev  = $ phpcsFile ->findPrevious (self :: getEmptyTokens () , ($ stackPtr  - 1 ), null , true );
1100+     $ prev  = $ phpcsFile ->findPrevious (Tokens:: $ emptyTokens  , ($ stackPtr  - 1 ), null , true );
10991101    if  ($ prev  === false ) {
11001102      return  false ;
11011103    }
@@ -1106,7 +1108,7 @@ public static function isTokenVariableVariable(File $phpcsFile, $stackPtr) {
11061108      return  false ;
11071109    }
11081110
1109-     $ prevPrev  = $ phpcsFile ->findPrevious (self :: getEmptyTokens () , ($ prev  - 1 ), null , true );
1111+     $ prevPrev  = $ phpcsFile ->findPrevious (Tokens:: $ emptyTokens  , ($ prev  - 1 ), null , true );
11101112    if  ($ prevPrev  !== false  && $ tokens [$ prevPrev ]['code ' ] === T_DOLLAR ) {
11111113      return  true ;
11121114    }
0 commit comments