isAnonymousFunction() public method

Check if the token at the specified position is a anonymous function.
public isAnonymousFunction ( integer $stackPtr ) : boolean
$stackPtr integer The position of the declaration token which declared the class, interface or function.
return boolean
 public function process(CodeSnifferFile $file, $stackPtr)
 {
     $tokens = $file->getTokens();
     if ($tokens[$stackPtr]['code'] === T_FUNCTION && $file->isAnonymousFunction($stackPtr)) {
         return;
     }
     $bracketPos = $file->findNext(T_OPEN_CURLY_BRACKET, $stackPtr, null, false, null, true);
     if (!$bracketPos) {
         return;
     }
     $symbolName = $file->getDeclarationName($stackPtr);
     $symbolType = $tokens[$stackPtr]['content'];
     if ($tokens[$bracketPos]['column'] !== 4 * $tokens[$stackPtr]['level'] + 1) {
         $file->addError('Opening bracket of "%s %s" must be in the next line', $stackPtr, sprintf('MissingNewline%sBrace', ucfirst($symbolType)), [$symbolType, $symbolName]);
     }
     $previousStringTokenPos = $file->findPrevious([T_STRING, T_CLOSE_PARENTHESIS], $bracketPos);
     if (1 + $tokens[$previousStringTokenPos]['line'] < $tokens[$bracketPos]['line']) {
         $file->addError('Exactly a single newline must follow after the declaration of "%s %s"', $stackPtr, sprintf('TooManyNewlines%sBrace', ucfirst($symbolType)), [$symbolType, $symbolName]);
     }
 }