SlevomatCodingStandard\Helpers\TokenHelper::findNextEffective PHP Méthode

findNextEffective() public static méthode

public static findNextEffective ( PHP_CodeSniffer_File $phpcsFile, integer $startPointer, integer | null $endPointer = null ) : integer | null
$phpcsFile PHP_CodeSniffer_File
$startPointer integer search starts at this token, inclusive
$endPointer integer | null search ends at this token, exclusive
Résultat integer | null
    public static function findNextEffective(PHP_CodeSniffer_File $phpcsFile, $startPointer, $endPointer = null)
    {
        return self::findNextExcluding($phpcsFile, self::$ineffectiveTokenCodes, $startPointer, $endPointer);
    }

Usage Example

 /**
  * @param \PHP_CodeSniffer_File $phpcsFile
  * @param integer $anyPointer any pointer type where the search begins from (backwards)
  * @return string|null
  */
 public static function findCurrentNamespaceName(PHP_CodeSniffer_File $phpcsFile, $anyPointer)
 {
     $namespacePointer = $phpcsFile->findPrevious(T_NAMESPACE, $anyPointer);
     if ($namespacePointer === false) {
         return null;
     }
     $namespaceNameStartPointer = TokenHelper::findNextEffective($phpcsFile, $namespacePointer + 1);
     $namespaceNameEndPointer = TokenHelper::findNextExcluding($phpcsFile, TokenHelper::$nameTokenCodes, $namespaceNameStartPointer + 1);
     return TokenHelper::getContent($phpcsFile, $namespaceNameStartPointer, $namespaceNameEndPointer);
 }
All Usage Examples Of SlevomatCodingStandard\Helpers\TokenHelper::findNextEffective