private function getAllTokens(File $phpcsFile, array $tokens, $start, $end): array
    {
        $found = [];

        $pointer = $start + 1;
        while (false !== $pointer && $pointer < $end) {
            $tokenPtr = $phpcsFile->findNext([T_VARIABLE], $pointer, $end - 1);

            // If no more tokens are found, return
            if (!\is_int($tokenPtr)) {
                return $found;
            }

            // Capture token
            $found[$tokens[$tokenPtr]['code']] = $tokenPtr;

            // Move pointer to next token
            $pointer = $tokenPtr + 1;
        }

        return $found;
    }
private function getAllTokens(File $phpcsFile, array $tokens, $start, $end): array
    {
        $found = [];

        $pointer = $start + 1;
        while (false !== $pointer && $pointer < $end) {
            $tokenPtr = $phpcsFile->findNext([T_VARIABLE], $pointer, $end - 1);

            // If no more tokens are found, return
            if (!\is_int($tokenPtr)) {
                return $found;
            }

            // Capture token
            $found[$tokens[$tokenPtr]['code']] = $tokenPtr;

            // Move pointer to next token
            $pointer = $tokenPtr + 1;
        }

        return $found;
    }
private function getAllTokens ( File $ phpcsFile , array $ tokens , $ start , $ end ) : array { $ found = [ ] ; $ pointer = $ start + 1 ; while ( false !== $ pointer && $ pointer < $ end ) { $ tokenPtr = $ phpcsFile -> findNext ( [ T_VARIABLE ] , $ pointer , $ end - 1 ) ; // If no more tokens are found, return if ( ! \ is_int ( $ tokenPtr ) ) { return $ found ; } // Capture token $ found [ $ tokens [ $ tokenPtr ] [ 'code' ] ] = $ tokenPtr ; // Move pointer to next token $ pointer = $ tokenPtr + 1 ; } return $ found ; }
Get all tokens matching types between two pointers

@param \PHP_CodeSniffer\Files\File $phpcsFile The file being checked
@param array $tokens The tokens found in file
@param int $start The position in the token stack to start searching from
@param int $end The position in the token stack to stop search at

@return array
Get all tokens matching types between two pointers