repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php
CaseSensitiveKeywordsSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $tokenContentLC = strtolower($tokens[$stackPtr]['content']); if ($tokenContentLC !== $tokens[$stackPtr]['conte...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $tokenContentLC = strtolower($tokens[$stackPtr]['content']); if ($tokenContentLC !== $tokens[$stackPtr]['conte...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.4'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/CaseSensitiveKeywordsSniff.php#L55-L72
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php
ForbiddenThisUseContextsSniff.register
public function register() { if (\defined('T_ANON_CLASS')) { $this->ooScopeTokens['T_ANON_CLASS'] = \T_ANON_CLASS; } $this->skipOverScopes += $this->ooScopeTokens; return array( \T_FUNCTION, \T_CLOSURE, \T_GLOBAL, \T_CATCH...
php
public function register() { if (\defined('T_ANON_CLASS')) { $this->ooScopeTokens['T_ANON_CLASS'] = \T_ANON_CLASS; } $this->skipOverScopes += $this->ooScopeTokens; return array( \T_FUNCTION, \T_CLOSURE, \T_GLOBAL, \T_CATCH...
[ "public", "function", "register", "(", ")", "{", "if", "(", "\\", "defined", "(", "'T_ANON_CLASS'", ")", ")", "{", "$", "this", "->", "ooScopeTokens", "[", "'T_ANON_CLASS'", "]", "=", "\\", "T_ANON_CLASS", ";", "}", "$", "this", "->", "skipOverScopes", "...
Returns an array of tokens this test wants to listen for. @since 9.1.0 @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php#L99-L115
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php
ForbiddenThisUseContextsSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.1') === false) { return; } $tokens = $phpcsFile->getTokens(); switch ($tokens[$stackPtr]['code']) { case \T_FUNCTION: $this->isThisUsedAsParameter($phpcsFile, $...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.1') === false) { return; } $tokens = $phpcsFile->getTokens(); switch ($tokens[$stackPtr]['code']) { case \T_FUNCTION: $this->isThisUsedAsParameter($phpcsFile, $...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.1'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @since 9.1.0 @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php#L128-L290
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php
ForbiddenThisUseContextsSniff.isThisUsedAsParameter
protected function isThisUsedAsParameter(File $phpcsFile, $stackPtr) { if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) !== false) { return; } $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); if (empty($params)) { ret...
php
protected function isThisUsedAsParameter(File $phpcsFile, $stackPtr) { if ($this->validDirectScope($phpcsFile, $stackPtr, $this->ooScopeTokens) !== false) { return; } $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); if (empty($params)) { ret...
[ "protected", "function", "isThisUsedAsParameter", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "validDirectScope", "(", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "this", "->", "ooScopeTokens", ")", "!...
Check if $this is used as a parameter in a function declaration. $this can no longer be used as a parameter in a *global* function. Use as a parameter in a method was already an error prior to PHP 7.1. @since 9.1.0 @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr...
[ "Check", "if", "$this", "is", "used", "as", "a", "parameter", "in", "a", "function", "declaration", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php#L306-L338
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php
ForbiddenThisUseContextsSniff.isThisUsedOutsideObjectContext
protected function isThisUsedOutsideObjectContext(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { return; } if ($this->validDirectScope($phpcsFile, $stackPtr,...
php
protected function isThisUsedOutsideObjectContext(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['scope_opener'], $tokens[$stackPtr]['scope_closer']) === false) { return; } if ($this->validDirectScope($phpcsFile, $stackPtr,...
[ "protected", "function", "isThisUsedOutsideObjectContext", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "isset", "(", "$", "tokens", "[", "$", "stackPtr", ...
Check if $this is used in a plain function or method. Prior to PHP 7.1, this would result in an "undefined variable" notice and execution would continue with $this regarded as `null`. As of PHP 7.1, this throws an exception. Note: use within isset() and empty() to check object context is still allowed. Note: $this ca...
[ "Check", "if", "$this", "is", "used", "in", "a", "plain", "function", "or", "method", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Variables/ForbiddenThisUseContextsSniff.php#L358-L423
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php
NewPCREModifiersSniff.examineModifiers
protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) { $error = 'The PCRE regex modifier "%s" is not present in PHP version %s or earlier'; foreach ($this->newModifiers as $modifier => $versionArray) { if (strpos($modifiers, $modifier) === false) { ...
php
protected function examineModifiers(File $phpcsFile, $stackPtr, $functionName, $modifiers) { $error = 'The PCRE regex modifier "%s" is not present in PHP version %s or earlier'; foreach ($this->newModifiers as $modifier => $versionArray) { if (strpos($modifiers, $modifier) === false) { ...
[ "protected", "function", "examineModifiers", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "functionName", ",", "$", "modifiers", ")", "{", "$", "error", "=", "'The PCRE regex modifier \"%s\" is not present in PHP version %s or earlier'", ";", "foreach"...
Examine the regex modifier string. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param string $functionName The function which contained the pattern. @param string ...
[ "Examine", "the", "regex", "modifier", "string", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/NewPCREModifiersSniff.php#L84-L114
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php
NewClassMemberAccessSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if ($tokens[$stackPtr]['code'] === \T_NEW && $this->supportsBelow('5.3') !== true) { return; } elseif ($tokens[$stackPtr]['code'] === \T_CLONE && $this->supportsBelow('5.6') !== true) { ...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if ($tokens[$stackPtr]['code'] === \T_NEW && $this->supportsBelow('5.3') !== true) { return; } elseif ($tokens[$stackPtr]['code'] === \T_CLONE && $this->supportsBelow('5.6') !== true) { ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'code'", "]", "===", ...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewClassMemberAccessSniff.php#L57-L112
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php
ForbiddenBreakContinueVariableArgumentsSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $nextSemicolonToken = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr), null, false); $e...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $nextSemicolonToken = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr), null, false); $e...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'5.4'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ControlStructures/ForbiddenBreakContinueVariableArgumentsSniff.php#L64-L100
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
NewClassesSniff.register
public function register() { // Handle case-insensitivity of class names. $this->newClasses = $this->arrayKeysToLowercase($this->newClasses); $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions); // Add the Exception classes to the Classes list. $this-...
php
public function register() { // Handle case-insensitivity of class names. $this->newClasses = $this->arrayKeysToLowercase($this->newClasses); $this->newExceptions = $this->arrayKeysToLowercase($this->newExceptions); // Add the Exception classes to the Classes list. $this-...
[ "public", "function", "register", "(", ")", "{", "// Handle case-insensitivity of class names.", "$", "this", "->", "newClasses", "=", "$", "this", "->", "arrayKeysToLowercase", "(", "$", "this", "->", "newClasses", ")", ";", "$", "this", "->", "newExceptions", ...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php#L576-L603
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
NewClassesSniff.processSingularToken
private function processSingularToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $FQClassName = ''; if ($tokens[$stackPtr]['type'] === 'T_NEW') { $FQClassName = $this->getFQClassNameFromNewToken($phpcsFile, $stackPtr); } elseif ($tokens[$stack...
php
private function processSingularToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $FQClassName = ''; if ($tokens[$stackPtr]['type'] === 'T_NEW') { $FQClassName = $this->getFQClassNameFromNewToken($phpcsFile, $stackPtr); } elseif ($tokens[$stack...
[ "private", "function", "processSingularToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "FQClassName", "=", "''", ";", "if", "(", "$", "tokens", "[", "$"...
Processes this test for when a token resulting in a singular class name is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "for", "when", "a", "token", "resulting", "in", "a", "singular", "class", "name", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php#L656-L687
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
NewClassesSniff.processFunctionToken
private function processFunctionToken(File $phpcsFile, $stackPtr) { // Retrieve typehints stripped of global NS indicator and/or nullable indicator. $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); if (empty($typeHints) || \is_array($typeHints) === false) { ...
php
private function processFunctionToken(File $phpcsFile, $stackPtr) { // Retrieve typehints stripped of global NS indicator and/or nullable indicator. $typeHints = $this->getTypeHintsFromFunctionDeclaration($phpcsFile, $stackPtr); if (empty($typeHints) || \is_array($typeHints) === false) { ...
[ "private", "function", "processFunctionToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "// Retrieve typehints stripped of global NS indicator and/or nullable indicator.", "$", "typeHints", "=", "$", "this", "->", "getTypeHintsFromFunctionDeclaration", "...
Processes this test for when a function token is encountered. - Detect new classes when used as a type hint. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "for", "when", "a", "function", "token", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php#L701-L721
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
NewClassesSniff.processCatchToken
private function processCatchToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Bow out during live coding. if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return; } $opener = $tok...
php
private function processCatchToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Bow out during live coding. if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return; } $opener = $tok...
[ "private", "function", "processCatchToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Bow out during live coding.", "if", "(", "isset", "(", "$", "tokens", "[", ...
Processes this test for when a catch token is encountered. - Detect exceptions when used in a catch statement. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "for", "when", "a", "catch", "token", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php#L735-L787
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewClassesSniff.php
NewClassesSniff.processReturnTypeToken
private function processReturnTypeToken(File $phpcsFile, $stackPtr) { $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); $returnTypeHint = ltrim($returnTypeHint, '\\'); $returnTypeHintLc = strtolower($returnTypeHint); if (isset($this->newClasses[$returnTypeHi...
php
private function processReturnTypeToken(File $phpcsFile, $stackPtr) { $returnTypeHint = $this->getReturnTypeHintName($phpcsFile, $stackPtr); $returnTypeHint = ltrim($returnTypeHint, '\\'); $returnTypeHintLc = strtolower($returnTypeHint); if (isset($this->newClasses[$returnTypeHi...
[ "private", "function", "processReturnTypeToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "returnTypeHint", "=", "$", "this", "->", "getReturnTypeHintName", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", ";", "$", "returnTypeHint"...
Processes this test for when a return type token is encountered. - Detect new classes when used as a return type declaration. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "for", "when", "a", "return", "type", "token", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewClassesSniff.php#L801-L817
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
ForbiddenNamesSniff.register
public function register() { $this->allowedModifiers = Tokens::$scopeModifiers; $this->allowedModifiers[\T_FINAL] = \T_FINAL; $tokens = $this->targetedTokens; if (\defined('T_ANON_CLASS')) { $tokens[] = \T_ANON_CLASS; } return $tokens; }
php
public function register() { $this->allowedModifiers = Tokens::$scopeModifiers; $this->allowedModifiers[\T_FINAL] = \T_FINAL; $tokens = $this->targetedTokens; if (\defined('T_ANON_CLASS')) { $tokens[] = \T_ANON_CLASS; } return $tokens; }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "allowedModifiers", "=", "Tokens", "::", "$", "scopeModifiers", ";", "$", "this", "->", "allowedModifiers", "[", "\\", "T_FINAL", "]", "=", "\\", "T_FINAL", ";", "$", "tokens", "=", "$",...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php#L136-L148
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
ForbiddenNamesSniff.processNonString
public function processNonString(File $phpcsFile, $stackPtr, $tokens) { $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($nextNonEmpty === false) { return; } /* * Deal with anonymous classes - `class` before a reserved...
php
public function processNonString(File $phpcsFile, $stackPtr, $tokens) { $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($nextNonEmpty === false) { return; } /* * Deal with anonymous classes - `class` before a reserved...
[ "public", "function", "processNonString", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "tokens", ")", "{", "$", "nextNonEmpty", "=", "$", "phpcsFile", "->", "findNext", "(", "Tokens", "::", "$", "emptyTokens", ",", "(", "$", "stackPtr", ...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param array $tokens The stack of tokens that make up the file. @retu...
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php#L184-L309
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
ForbiddenNamesSniff.processString
public function processString(File $phpcsFile, $stackPtr, $tokens) { $tokenContentLc = strtolower($tokens[$stackPtr]['content']); /* * Special case for PHP versions where the target is not yet identified as * its own token, but presents as T_STRING. * - trait keyword in P...
php
public function processString(File $phpcsFile, $stackPtr, $tokens) { $tokenContentLc = strtolower($tokens[$stackPtr]['content']); /* * Special case for PHP versions where the target is not yet identified as * its own token, but presents as T_STRING. * - trait keyword in P...
[ "public", "function", "processString", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "tokens", ")", "{", "$", "tokenContentLc", "=", "strtolower", "(", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'content'", "]", ")", ";", "/*\n ...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param array $tokens The stack of tokens that make up the file. @retu...
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php#L322-L357
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php
ForbiddenNamesSniff.addError
protected function addError(File $phpcsFile, $stackPtr, $content, $data) { $error = "Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)"; $errorCode = $this->stringToErrorCode($content) . 'Found'; $phpcsFile->addError($error, $s...
php
protected function addError(File $phpcsFile, $stackPtr, $content, $data) { $error = "Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)"; $errorCode = $this->stringToErrorCode($content) . 'Found'; $phpcsFile->addError($error, $s...
[ "protected", "function", "addError", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "content", ",", "$", "data", ")", "{", "$", "error", "=", "\"Function name, class name, namespace name or constant name can not be reserved keyword '%s' (since version %s)\""...
Add the error message. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param string $content The token content found. @param array $data The data to pass into...
[ "Add", "the", "error", "message", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesSniff.php#L371-L376
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php
NewFunctionCallTrailingCommaSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.2') === false) { return; } $tokens = $phpcsFile->getTokens(); $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($tokens[$nextNonEmpty]['c...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.2') === false) { return; } $tokens = $phpcsFile->getTokens(); $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($tokens[$nextNonEmpty]['c...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'7.2'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewFunctionCallTrailingCommaSniff.php#L54-L114
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php
NewConstantsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $constantName = $tokens[$stackPtr]['content']; if (isset($this->newConstants[$constantName]) === false) { return; } if ($this->isUseOfGlobalConstant($phpcsFile, $stack...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $constantName = $tokens[$stackPtr]['content']; if (isset($this->newConstants[$constantName]) === false) { return; } if ($this->isUseOfGlobalConstant($phpcsFile, $stack...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "constantName", "=", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'content'"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Constants/NewConstantsSniff.php#L3469-L3486
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php
ForbiddenGlobalVariableVariableSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1)); if ($endOfStatement...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $endOfStatement = $phpcsFile->findNext(array(\T_SEMICOLON, \T_CLOSE_TAG), ($stackPtr + 1)); if ($endOfStatement...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.0'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Variables/ForbiddenGlobalVariableVariableSniff.php#L51-L123
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php
ForbiddenNamesAsInvokedFunctionsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenCode = $tokens[$stackPtr]['code']; $tokenContentLc = strtolower($tokens[$stackPtr]['content']); $isString = false; /* * For string tokens we only care i...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenCode = $tokens[$stackPtr]['code']; $tokenContentLc = strtolower($tokens[$stackPtr]['content']); $isString = false; /* * For string tokens we only care i...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "tokenCode", "=", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'code'", "]...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/ForbiddenNamesAsInvokedFunctionsSniff.php#L105-L180
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php
NewNullableTypesSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $tokenCode = $tokens[$stackPtr]['code']; if ($tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE) { ...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $tokenCode = $tokens[$stackPtr]['code']; if ($tokenCode === \T_FUNCTION || $tokenCode === \T_CLOSURE) { ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'7.0'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php#L65-L86
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php
NewNullableTypesSniff.processFunctionDeclaration
protected function processFunctionDeclaration(File $phpcsFile, $stackPtr) { $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); if (empty($params) === false && \is_array($params)) { foreach ($params as $param) { if ($param['nullable_type'] === true) { ...
php
protected function processFunctionDeclaration(File $phpcsFile, $stackPtr) { $params = PHPCSHelper::getMethodParameters($phpcsFile, $stackPtr); if (empty($params) === false && \is_array($params)) { foreach ($params as $param) { if ($param['nullable_type'] === true) { ...
[ "protected", "function", "processFunctionDeclaration", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "params", "=", "PHPCSHelper", "::", "getMethodParameters", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", ";", "if", "(", "empty", "...
Process this test for function tokens. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Process", "this", "test", "for", "function", "tokens", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php#L98-L114
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php
NewNullableTypesSniff.processReturnType
protected function processReturnType(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[($stackPtr - 1)]['code']) === false) { return; } $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); // ...
php
protected function processReturnType(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[($stackPtr - 1)]['code']) === false) { return; } $previous = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); // ...
[ "protected", "function", "processReturnType", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "isset", "(", "$", "tokens", "[", "(", "$", "stackPtr", "-",...
Process this test for return type tokens. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Process", "this", "test", "for", "return", "type", "tokens", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewNullableTypesSniff.php#L126-L161
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php
NewFopenModesSniff.processParameters
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { if (isset($parameters[2]) === false) { return; } $tokens = $phpcsFile->getTokens(); $targetParam = $parameters[2]; $errors = array(); for ($i = $targetP...
php
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { if (isset($parameters[2]) === false) { return; } $tokens = $phpcsFile->getTokens(); $targetParam = $parameters[2]; $errors = array(); for ($i = $targetP...
[ "public", "function", "processParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "functionName", ",", "$", "parameters", ")", "{", "if", "(", "isset", "(", "$", "parameters", "[", "2", "]", ")", "===", "false", ")", "{", "retur...
Process the parameters of a matched function. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack. @param string $functionName The token content (function name) which was matched. @param array ...
[ "Process", "the", "parameters", "of", "a", "matched", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/NewFopenModesSniff.php#L61-L111
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php
NewOperatorsSniff.register
public function register() { $tokens = array(); foreach ($this->newOperators as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } elseif (isset($this->newOperatorsPHPCSCompat[$token])) { $tokens[] = $this->newOperat...
php
public function register() { $tokens = array(); foreach ($this->newOperators as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } elseif (isset($this->newOperatorsPHPCSCompat[$token])) { $tokens[] = $this->newOperat...
[ "public", "function", "register", "(", ")", "{", "$", "tokens", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "newOperators", "as", "$", "token", "=>", "$", "versions", ")", "{", "if", "(", "\\", "defined", "(", "$", "token", ")",...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php#L128-L139
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php
NewOperatorsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Translate older PHPCS token combis for new operators to the actual operator. if (isset($this->newOperators[$tokenType]) === false) { if...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Translate older PHPCS token combis for new operators to the actual operator. if (isset($this->newOperators[$tokenType]) === false) { if...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "tokenType", "=", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'type'", "]...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php#L151-L183
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php
NewOperatorsSniff.isTCoalesceEqual
private function isTCoalesceEqual($tokens, $stackPtr) { if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) { // Function called for wrong token or token has no predecesor. return false; } if ($tokens[($stackPtr - 1)]['type'] ===...
php
private function isTCoalesceEqual($tokens, $stackPtr) { if ($tokens[$stackPtr]['code'] !== \T_EQUAL || isset($tokens[($stackPtr - 1)]) === false) { // Function called for wrong token or token has no predecesor. return false; } if ($tokens[($stackPtr - 1)]['type'] ===...
[ "private", "function", "isTCoalesceEqual", "(", "$", "tokens", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'code'", "]", "!==", "\\", "T_EQUAL", "||", "isset", "(", "$", "tokens", "[", "(", "$", "stackPt...
Callback function to determine whether a T_EQUAL token is really a T_COALESCE_EQUAL token. @param array $tokens The token stack. @param int $stackPtr The current position in the token stack. @return bool
[ "Callback", "function", "to", "determine", "whether", "a", "T_EQUAL", "token", "is", "really", "a", "T_COALESCE_EQUAL", "token", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php#L251-L268
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php
NewOperatorsSniff.isTCoalesce
private function isTCoalesce($tokens, $stackPtr) { if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) { // Function called for wrong token or token has no predecesor. return false; } if ($tokens[($stackPtr - 1)]['code'] ==...
php
private function isTCoalesce($tokens, $stackPtr) { if ($tokens[$stackPtr]['code'] !== \T_INLINE_THEN || isset($tokens[($stackPtr - 1)]) === false) { // Function called for wrong token or token has no predecesor. return false; } if ($tokens[($stackPtr - 1)]['code'] ==...
[ "private", "function", "isTCoalesce", "(", "$", "tokens", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'code'", "]", "!==", "\\", "T_INLINE_THEN", "||", "isset", "(", "$", "tokens", "[", "(", "$", "stackP...
Callback function to determine whether a T_INLINE_THEN token is really a T_COALESCE token. @param array $tokens The token stack. @param int $stackPtr The current position in the token stack. @return bool
[ "Callback", "function", "to", "determine", "whether", "a", "T_INLINE_THEN", "token", "is", "really", "a", "T_COALESCE", "token", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Operators/NewOperatorsSniff.php#L278-L293
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php
RequiredToOptionalFunctionParametersSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION => true, \T_CONST => true, ); $prevToken = ...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION => true, \T_CONST => true, ); $prevToken = ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "ignore", "=", "array", "(", "\\", "T_DOUBLE_COLON", "=>", "true", ",", "\\", ...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php#L160-L204
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php
RequiredToOptionalFunctionParametersSniff.addError
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) { $error = $this->getErrorMsgTemplate(); $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing'; $data = array( $errorInfo['paramName'], ...
php
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) { $error = $this->getErrorMsgTemplate(); $errorCode = $this->stringToErrorCode($itemInfo['name'] . '_' . $errorInfo['paramName']) . 'Missing'; $data = array( $errorInfo['paramName'], ...
[ "public", "function", "addError", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "array", "$", "itemInfo", ",", "array", "$", "errorInfo", ")", "{", "$", "error", "=", "$", "this", "->", "getErrorMsgTemplate", "(", ")", ";", "$", "errorCode", ...
Generates the error or warning for this item. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the relevant token in the stack. @param array $itemInfo Base information about the item. @param array $errorInfo Array w...
[ "Generates", "the", "error", "or", "warning", "for", "this", "item", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php#L298-L309
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php
NewKeywordsSniff.register
public function register() { $tokens = array(); $translate = array(); foreach ($this->newKeywords as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } if (isset($versions['content'])) { $trans...
php
public function register() { $tokens = array(); $translate = array(); foreach ($this->newKeywords as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } if (isset($versions['content'])) { $trans...
[ "public", "function", "register", "(", ")", "{", "$", "tokens", "=", "array", "(", ")", ";", "$", "translate", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "newKeywords", "as", "$", "token", "=>", "$", "versions", ")", "{", "if",...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php#L162-L185
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php
NewKeywordsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Allow for dealing with multi-token keywords, like "yield from". $end = $stackPtr; // Translate T_STRING token if necessary. if ($t...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Allow for dealing with multi-token keywords, like "yield from". $end = $stackPtr; // Translate T_STRING token if necessary. if ($t...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "tokenType", "=", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'type'", "]...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Keywords/NewKeywordsSniff.php#L197-L285
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php
NewClosureSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.2')) { $phpcsFile->addError( 'Closures / anonymous functions are not available in PHP 5.2 or earlier', $stackPtr, 'Found' ); } /* ...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.2')) { $phpcsFile->addError( 'Closures / anonymous functions are not available in PHP 5.2 or earlier', $stackPtr, 'Found' ); } /* ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.2'", ")", ")", "{", "$", "phpcsFile", "->", "addError", "(", "'Closures / anonymous functions are not availa...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php#L50-L158
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php
NewClosureSniff.isClosureStatic
protected function isClosureStatic(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); return ($prevToken !== false && $tokens[$prevToken]['code'] === \T_STATIC); }
php
protected function isClosureStatic(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); return ($prevToken !== false && $tokens[$prevToken]['code'] === \T_STATIC); }
[ "protected", "function", "isClosureStatic", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "prevToken", "=", "$", "phpcsFile", "->", "findPrevious", "(", "Tokens",...
Check whether the closure is declared as static. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return bool
[ "Check", "whether", "the", "closure", "is", "declared", "as", "static", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php#L170-L176
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php
NewClosureSniff.findThisUsageInClosure
protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken) { // Make sure the $startToken is valid. if ($startToken >= $endToken) { return false; } return $phpcsFile->findNext( \T_VARIABLE, $startToken, $endToke...
php
protected function findThisUsageInClosure(File $phpcsFile, $startToken, $endToken) { // Make sure the $startToken is valid. if ($startToken >= $endToken) { return false; } return $phpcsFile->findNext( \T_VARIABLE, $startToken, $endToke...
[ "protected", "function", "findThisUsageInClosure", "(", "File", "$", "phpcsFile", ",", "$", "startToken", ",", "$", "endToken", ")", "{", "// Make sure the $startToken is valid.", "if", "(", "$", "startToken", ">=", "$", "endToken", ")", "{", "return", "false", ...
Check if the code within a closure uses the $this variable. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $startToken The position within the closure to continue searching from. @param int $endToken The closure scope closer to stop searching at. @ret...
[ "Check", "if", "the", "code", "within", "a", "closure", "uses", "the", "$this", "variable", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php#L189-L203
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php
NewClosureSniff.findClassRefUsageInClosure
protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken) { // Make sure the $startToken is valid. if ($startToken >= $endToken) { return false; } $tokens = $phpcsFile->getTokens(); $classRef = $phpcsFile->findNext(array(\T_SELF, \T...
php
protected function findClassRefUsageInClosure(File $phpcsFile, $startToken, $endToken) { // Make sure the $startToken is valid. if ($startToken >= $endToken) { return false; } $tokens = $phpcsFile->getTokens(); $classRef = $phpcsFile->findNext(array(\T_SELF, \T...
[ "protected", "function", "findClassRefUsageInClosure", "(", "File", "$", "phpcsFile", ",", "$", "startToken", ",", "$", "endToken", ")", "{", "// Make sure the $startToken is valid.", "if", "(", "$", "startToken", ">=", "$", "endToken", ")", "{", "return", "false"...
Check if the code within a closure uses "self/parent/static". @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $startToken The position within the closure to continue searching from. @param int $endToken The closure scope closer to stop searching at. @r...
[ "Check", "if", "the", "code", "within", "a", "closure", "uses", "self", "/", "parent", "/", "static", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NewClosureSniff.php#L215-L236
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php
NewHashAlgorithmsSniff.process
public function process(File $phpcsFile, $stackPtr) { $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); if (empty($algo) || \is_string($algo) === false) { return; } // Bow out if not one of the algorithms we're targetting. if (isset($this->newAlgor...
php
public function process(File $phpcsFile, $stackPtr) { $algo = $this->getHashAlgorithmParameter($phpcsFile, $stackPtr); if (empty($algo) || \is_string($algo) === false) { return; } // Bow out if not one of the algorithms we're targetting. if (isset($this->newAlgor...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "algo", "=", "$", "this", "->", "getHashAlgorithmParameter", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", ";", "if", "(", "empty", "(", "$", "algo...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/NewHashAlgorithmsSniff.php#L125-L142
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php
ForbiddenNegativeBitshiftSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); // Determine the start and end of the part of the statement we need to examine. $start = ($stackPtr + 1); $nex...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); // Determine the start and end of the part of the statement we need to examine. $start = ($stackPtr + 1); $nex...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.0'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Operators/ForbiddenNegativeBitshiftSniff.php#L72-L103
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php
NewNegativeStringOffsetSniff.processParameters
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { $functionLC = strtolower($functionName); foreach ($this->targetFunctions[$functionLC] as $pos => $name) { if (isset($parameters[$pos]) === false) { continue; } ...
php
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { $functionLC = strtolower($functionName); foreach ($this->targetFunctions[$functionLC] as $pos => $name) { if (isset($parameters[$pos]) === false) { continue; } ...
[ "public", "function", "processParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "functionName", ",", "$", "parameters", ")", "{", "$", "functionLC", "=", "strtolower", "(", "$", "functionName", ")", ";", "foreach", "(", "$", "this...
Process the parameters of a matched function. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack. @param string $functionName The token content (function name) which was matched. @param array ...
[ "Process", "the", "parameters", "of", "a", "matched", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/NewNegativeStringOffsetSniff.php#L100-L125
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php
NewListInForeachSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return;...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return;...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.4'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ControlStructures/NewListInForeachSniff.php#L48-L78
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php
NewTypeCastsSniff.register
public function register() { $tokens = array(); foreach ($this->newTypeCasts as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } } /* * Work around tokenizer issues. * * - (binary) cast ...
php
public function register() { $tokens = array(); foreach ($this->newTypeCasts as $token => $versions) { if (\defined($token)) { $tokens[] = constant($token); } } /* * Work around tokenizer issues. * * - (binary) cast ...
[ "public", "function", "register", "(", ")", "{", "$", "tokens", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "newTypeCasts", "as", "$", "token", "=>", "$", "versions", ")", "{", "if", "(", "\\", "defined", "(", "$", "token", ")",...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php#L53-L77
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php
NewTypeCastsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Detect incorrectly tokenized binary casts. if (isset($this->newTypeCasts[$tokenType]) === false) { $tokenContent = $tokens[$stackPtr]['...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $tokenType = $tokens[$stackPtr]['type']; // Detect incorrectly tokenized binary casts. if (isset($this->newTypeCasts[$tokenType]) === false) { $tokenContent = $tokens[$stackPtr]['...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "tokenType", "=", "$", "tokens", "[", "$", "stackPtr", "]", "[", "'type'", "]...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/TypeCasts/NewTypeCastsSniff.php#L89-L129
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php
ReservedFunctionNamesSniff.processTokenWithinScope
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope) { $tokens = $phpcsFile->getTokens(); /* * Determine if this is a function which needs to be examined. * The `processTokenWithinScope()` is called for each valid scope a method is in, * so f...
php
protected function processTokenWithinScope(File $phpcsFile, $stackPtr, $currScope) { $tokens = $phpcsFile->getTokens(); /* * Determine if this is a function which needs to be examined. * The `processTokenWithinScope()` is called for each valid scope a method is in, * so f...
[ "protected", "function", "processTokenWithinScope", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "currScope", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "/*\n * Determine if this is a function which ne...
Processes the tokens within the scope. @param \PHP_CodeSniffer_File $phpcsFile The file being processed. @param int $stackPtr The position where this token was found. @param int $currScope The position of the current scope. @return void
[ "Processes", "the", "tokens", "within", "the", "scope", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php#L68-L111
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php
ReservedFunctionNamesSniff.processTokenOutsideScope
protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) { $functionName = $phpcsFile->getDeclarationName($stackPtr); if ($functionName === null) { // Ignore closures. return; } // Is this a magic function. i.e., it is prefixed with "__". ...
php
protected function processTokenOutsideScope(File $phpcsFile, $stackPtr) { $functionName = $phpcsFile->getDeclarationName($stackPtr); if ($functionName === null) { // Ignore closures. return; } // Is this a magic function. i.e., it is prefixed with "__". ...
[ "protected", "function", "processTokenOutsideScope", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "functionName", "=", "$", "phpcsFile", "->", "getDeclarationName", "(", "$", "stackPtr", ")", ";", "if", "(", "$", "functionName", "===", ...
Processes the tokens outside the scope. @param \PHP_CodeSniffer_File $phpcsFile The file being processed. @param int $stackPtr The position where this token was found. @return void
[ "Processes", "the", "tokens", "outside", "the", "scope", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionNameRestrictions/ReservedFunctionNamesSniff.php#L123-L143
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php
RemovedFunctionsSniff.process
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION => true, \T_CLASS => true, \T_CONST =>...
php
public function process(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION => true, \T_CLASS => true, \T_CONST =>...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "ignore", "=", "array", "(", "\\", "T_DOUBLE_COLON", "=>", "true", ",", "\\", ...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/RemovedFunctionsSniff.php#L913-L945
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php
NewConstantScalarExpressionsSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->bowOutEarly() === true) { return; } $tokens = $phpcsFile->getTokens(); switch ($tokens[$stackPtr]['type']) { case 'T_FUNCTION': case 'T_CLOSURE': $params = PHPCSHelp...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->bowOutEarly() === true) { return; } $tokens = $phpcsFile->getTokens(); switch ($tokens[$stackPtr]['type']) { case 'T_FUNCTION': case 'T_CLOSURE': $params = PHPCSHelp...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "bowOutEarly", "(", ")", "===", "true", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void|int Null or integer stack pointer to skip forward.
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php#L141-L293
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php
NewConstantScalarExpressionsSniff.isValidAssignment
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) { $tokens = $phpcsFile->getTokens(); $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { // No value assigned. ...
php
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) { $tokens = $phpcsFile->getTokens(); $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { // No value assigned. ...
[ "protected", "function", "isValidAssignment", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "end", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "next", "=", "$", "phpcsFile", "->", "findNext", ...
Is a value declared and is the value declared valid pre-PHP 5.6 ? @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param int $end The end of the value definition. This will ...
[ "Is", "a", "value", "declared", "and", "is", "the", "value", "declared", "valid", "pre", "-", "PHP", "5", ".", "6", "?" ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php#L307-L317
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php
NewConstantScalarExpressionsSniff.isStaticValue
protected function isStaticValue(File $phpcsFile, $tokens, $start, $end, $nestedArrays = 0) { $nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true); if ($nextNonSimple === false) { return true; } /* * OK, so we have at least one to...
php
protected function isStaticValue(File $phpcsFile, $tokens, $start, $end, $nestedArrays = 0) { $nextNonSimple = $phpcsFile->findNext($this->safeOperands, $start, ($end + 1), true); if ($nextNonSimple === false) { return true; } /* * OK, so we have at least one to...
[ "protected", "function", "isStaticValue", "(", "File", "$", "phpcsFile", ",", "$", "tokens", ",", "$", "start", ",", "$", "end", ",", "$", "nestedArrays", "=", "0", ")", "{", "$", "nextNonSimple", "=", "$", "phpcsFile", "->", "findNext", "(", "$", "thi...
Is a value declared and is the value declared constant as accepted in PHP 5.5 and lower ? @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param array $tokens The token stack of the current file. @param int $start The stackPtr from which to start examin...
[ "Is", "a", "value", "declared", "and", "is", "the", "value", "declared", "constant", "as", "accepted", "in", "PHP", "5", ".", "5", "and", "lower", "?" ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php#L334-L461
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php
NewConstantScalarExpressionsSniff.throwError
protected function throwError(File $phpcsFile, $stackPtr, $type, $content = '') { $error = static::ERROR_PHRASE; $phrase = ''; $errorCode = 'Found'; if (isset($this->errorPhrases[$type]) === true) { $errorCode = $this->stringToErrorCode($type) . 'Found'; ...
php
protected function throwError(File $phpcsFile, $stackPtr, $type, $content = '') { $error = static::ERROR_PHRASE; $phrase = ''; $errorCode = 'Found'; if (isset($this->errorPhrases[$type]) === true) { $errorCode = $this->stringToErrorCode($type) . 'Found'; ...
[ "protected", "function", "throwError", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "type", ",", "$", "content", "=", "''", ")", "{", "$", "error", "=", "static", "::", "ERROR_PHRASE", ";", "$", "phrase", "=", "''", ";", "$", "error...
Throw an error if a scalar expression is found. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the token to link the error to. @param string $type Type of usage found. @param string $content Optional. The valu...
[ "Throw", "an", "error", "if", "a", "scalar", "expression", "is", "found", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php#L474-L493
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php
NewConstantScalarExpressionsSniff.isRealEndOfDeclaration
private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel) { // Ignore anything within short array definition brackets for now. if ($tokens[$endPtr]['code'] === \T_OPEN_SHORT_ARRAY && (isset($tokens[$endPtr]['bracket_opener']) && $tokens[$endPtr]['bracket_ope...
php
private function isRealEndOfDeclaration($tokens, $endPtr, $targetLevel) { // Ignore anything within short array definition brackets for now. if ($tokens[$endPtr]['code'] === \T_OPEN_SHORT_ARRAY && (isset($tokens[$endPtr]['bracket_opener']) && $tokens[$endPtr]['bracket_ope...
[ "private", "function", "isRealEndOfDeclaration", "(", "$", "tokens", ",", "$", "endPtr", ",", "$", "targetLevel", ")", "{", "// Ignore anything within short array definition brackets for now.", "if", "(", "$", "tokens", "[", "$", "endPtr", "]", "[", "'code'", "]", ...
Helper function to find the end of multi variable/constant declarations. Checks whether a certain part of a declaration needs to be skipped over or if it is the real end of the declaration. @param array $tokens Token stack of the current file. @param int $endPtr The token to examine as a candidate end poi...
[ "Helper", "function", "to", "find", "the", "end", "of", "multi", "variable", "/", "constant", "declarations", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantScalarExpressionsSniff.php#L508-L533
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php
RemovedNewReferenceSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('5.3') === false) { return; } $tokens = $phpcsFile->getTokens(); $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); if ($prevNonEmpty ==...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('5.3') === false) { return; } $tokens = $phpcsFile->getTokens(); $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true); if ($prevNonEmpty ==...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'5.3'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/RemovedNewReferenceSniff.php#L53-L76
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php
RemovedMagicAutoloadSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.2') === false) { return; } $funcName = $phpcsFile->getDeclarationName($stackPtr); if (strtolower($funcName) !== '__autoload') { return; } if ($this->validDirec...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.2') === false) { return; } $funcName = $phpcsFile->getDeclarationName($stackPtr); if (strtolower($funcName) !== '__autoload') { return; } if ($this->validDirec...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.2'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "funcName", "=", "$", "phpcsFile", "-...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedMagicAutoloadSniff.php#L58-L79
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php
NewConstantArraysUsingDefineSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.6') !== true) { return; } $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION ...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.6') !== true) { return; } $tokens = $phpcsFile->getTokens(); $ignore = array( \T_DOUBLE_COLON => true, \T_OBJECT_OPERATOR => true, \T_FUNCTION ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.6'", ")", "!==", "true", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->",...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewConstantArraysUsingDefineSniff.php#L50-L96
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php
NewConstVisibilitySniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); // Is the pre...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $prevToken = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true, null, true); // Is the pre...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'7.0'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Classes/NewConstVisibilitySniff.php#L50-L77
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php
NewEmptyNonVariableSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $open = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); if ($open === false ...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); $open = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true, null, true); if ($open === false ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.4'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/LanguageConstructs/NewEmptyNonVariableSniff.php#L51-L83
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.supportsAbove
public function supportsAbove($phpVersion) { $testVersion = $this->getTestVersion(); $testVersion = $testVersion[1]; if (\is_null($testVersion) || version_compare($testVersion, $phpVersion) >= 0 ) { return true; } else { return false; ...
php
public function supportsAbove($phpVersion) { $testVersion = $this->getTestVersion(); $testVersion = $testVersion[1]; if (\is_null($testVersion) || version_compare($testVersion, $phpVersion) >= 0 ) { return true; } else { return false; ...
[ "public", "function", "supportsAbove", "(", "$", "phpVersion", ")", "{", "$", "testVersion", "=", "$", "this", "->", "getTestVersion", "(", ")", ";", "$", "testVersion", "=", "$", "testVersion", "[", "1", "]", ";", "if", "(", "\\", "is_null", "(", "$",...
Check whether a specific PHP version is equal to or higher than the maximum supported PHP version as provided by the user in `testVersion`. Should be used when sniffing for *old* PHP features (deprecated/removed). @param string $phpVersion A PHP version number in 'major.minor' format. @return bool True if testVersio...
[ "Check", "whether", "a", "specific", "PHP", "version", "is", "equal", "to", "or", "higher", "than", "the", "maximum", "supported", "PHP", "version", "as", "provided", "by", "the", "user", "in", "testVersion", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L176-L188
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.addMessage
public function addMessage(File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array()) { if ($isError === true) { $phpcsFile->addError($message, $stackPtr, $code, $data); } else { $phpcsFile->addWarning($message, $stackPtr, $code, $data); } }
php
public function addMessage(File $phpcsFile, $message, $stackPtr, $isError, $code = 'Found', $data = array()) { if ($isError === true) { $phpcsFile->addError($message, $stackPtr, $code, $data); } else { $phpcsFile->addWarning($message, $stackPtr, $code, $data); } }
[ "public", "function", "addMessage", "(", "File", "$", "phpcsFile", ",", "$", "message", ",", "$", "stackPtr", ",", "$", "isError", ",", "$", "code", "=", "'Found'", ",", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "$", "isError", "===...
Add a PHPCS message to the output stack as either a warning or an error. @param \PHP_CodeSniffer_File $phpcsFile The file the message applies to. @param string $message The message. @param int $stackPtr The position of the token the message relates to. @param bool $...
[ "Add", "a", "PHPCS", "message", "to", "the", "output", "stack", "as", "either", "a", "warning", "or", "an", "error", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L234-L241
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.stripVariables
public function stripVariables($string) { if (strpos($string, '$') === false) { return $string; } return preg_replace(self::REGEX_COMPLEX_VARS, '', $string); }
php
public function stripVariables($string) { if (strpos($string, '$') === false) { return $string; } return preg_replace(self::REGEX_COMPLEX_VARS, '', $string); }
[ "public", "function", "stripVariables", "(", "$", "string", ")", "{", "if", "(", "strpos", "(", "$", "string", ",", "'$'", ")", "===", "false", ")", "{", "return", "$", "string", ";", "}", "return", "preg_replace", "(", "self", "::", "REGEX_COMPLEX_VARS"...
Strip variables from an arbitrary double quoted string. Intended for use with the contents of a T_DOUBLE_QUOTED_STRING. @param string $string The raw string. @return string String without variables in it.
[ "Strip", "variables", "from", "an", "arbitrary", "double", "quoted", "string", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L283-L290
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.doesFunctionCallHaveParameters
public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of the tokens this function handles...
php
public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of the tokens this function handles...
[ "public", "function", "doesFunctionCallHaveParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$...
Checks if a function call has parameters. Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. If passed a T_STRING which is *not* a function call, the behaviour is unreliable. Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it will detect whether the array has...
[ "Checks", "if", "a", "function", "call", "has", "parameters", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L323-L372
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFunctionCallParameterCount
public function getFunctionCallParameterCount(File $phpcsFile, $stackPtr) { if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { return 0; } return \count($this->getFunctionCallParameters($phpcsFile, $stackPtr)); }
php
public function getFunctionCallParameterCount(File $phpcsFile, $stackPtr) { if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { return 0; } return \count($this->getFunctionCallParameters($phpcsFile, $stackPtr)); }
[ "public", "function", "getFunctionCallParameterCount", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "doesFunctionCallHaveParameters", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", "===", "false", ")", "{", ...
Count the number of parameters a function call has been passed. Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. If passed a T_STRING which is *not* a function call, the behaviour is unreliable. Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it will return...
[ "Count", "the", "number", "of", "parameters", "a", "function", "call", "has", "been", "passed", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L393-L400
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFunctionCallParameters
public function getFunctionCallParameters(File $phpcsFile, $stackPtr) { if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { return array(); } // Ok, we know we have a T_STRING, T_VARIABLE, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters // and val...
php
public function getFunctionCallParameters(File $phpcsFile, $stackPtr) { if ($this->doesFunctionCallHaveParameters($phpcsFile, $stackPtr) === false) { return array(); } // Ok, we know we have a T_STRING, T_VARIABLE, T_ARRAY or T_OPEN_SHORT_ARRAY with parameters // and val...
[ "public", "function", "getFunctionCallParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "doesFunctionCallHaveParameters", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", "===", "false", ")", "{", "ret...
Get information on all parameters passed to a function call. Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. If passed a T_STRING which is *not* a function call, the behaviour is unreliable. Will return an multi-dimentional array with the start token pointer, end token pointer and...
[ "Get", "information", "on", "all", "parameters", "passed", "to", "a", "function", "call", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L421-L509
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFunctionCallParameter
public function getFunctionCallParameter(File $phpcsFile, $stackPtr, $paramOffset) { $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); if (isset($parameters[$paramOffset]) === false) { return false; } else { return $parameters[$paramOffset]; ...
php
public function getFunctionCallParameter(File $phpcsFile, $stackPtr, $paramOffset) { $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr); if (isset($parameters[$paramOffset]) === false) { return false; } else { return $parameters[$paramOffset]; ...
[ "public", "function", "getFunctionCallParameter", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "paramOffset", ")", "{", "$", "parameters", "=", "$", "this", "->", "getFunctionCallParameters", "(", "$", "phpcsFile", ",", "$", "stackPtr", ")", ...
Get information on a specific parameter passed to a function call. Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call. If passed a T_STRING which is *not* a function call, the behaviour is unreliable. Will return a array with the start token pointer, end token pointer and the raw valu...
[ "Get", "information", "on", "a", "specific", "parameter", "passed", "to", "a", "function", "call", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L528-L537
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.tokenHasScope
public function tokenHasScope(File $phpcsFile, $stackPtr, $validScopes = null) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // No conditions = no scope. if (empty...
php
public function tokenHasScope(File $phpcsFile, $stackPtr, $validScopes = null) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // No conditions = no scope. if (empty...
[ "public", "function", "tokenHasScope", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "validScopes", "=", "null", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if"...
Verify whether a token is within a scoped condition. If the optional $validScopes parameter has been passed, the function will check that the token has at least one condition which is of a type defined in $validScopes. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $sta...
[ "Verify", "whether", "a", "token", "is", "within", "a", "scoped", "condition", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L558-L578
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.inClassScope
public function inClassScope(File $phpcsFile, $stackPtr, $strict = true) { $validScopes = array(\T_CLASS); if (\defined('T_ANON_CLASS') === true) { $validScopes[] = \T_ANON_CLASS; } if ($strict === false) { $validScopes[] = \T_INTERFACE; $validSco...
php
public function inClassScope(File $phpcsFile, $stackPtr, $strict = true) { $validScopes = array(\T_CLASS); if (\defined('T_ANON_CLASS') === true) { $validScopes[] = \T_ANON_CLASS; } if ($strict === false) { $validScopes[] = \T_INTERFACE; $validSco...
[ "public", "function", "inClassScope", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "strict", "=", "true", ")", "{", "$", "validScopes", "=", "array", "(", "\\", "T_CLASS", ")", ";", "if", "(", "\\", "defined", "(", "'T_ANON_CLASS'", "...
Verify whether a token is within a class scope. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the token. @param bool $strict Whether to strictly check for the T_CLASS scope or also accept interfaces and traits as scope. @ret...
[ "Verify", "whether", "a", "token", "is", "within", "a", "class", "scope", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L592-L605
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFQClassNameFromNewToken
public function getFQClassNameFromNewToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_NEW) { ...
php
public function getFQClassNameFromNewToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_NEW) { ...
[ "public", "function", "getFQClassNameFromNewToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$", ...
Returns the fully qualified class name for a new class instantiation. Returns an empty string if the class name could not be reliably inferred. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of a T_NEW token. @return string
[ "Returns", "the", "fully", "qualified", "class", "name", "for", "a", "new", "class", "instantiation", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L618-L658
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFQExtendedClassName
public function getFQExtendedClassName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_CLASS && $t...
php
public function getFQExtendedClassName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_CLASS && $t...
[ "public", "function", "getFQExtendedClassName", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$", "to...
Returns the fully qualified name of the class that the specified class extends. Returns an empty string if the class does not extend another class or if the class name could not be reliably inferred. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position o...
[ "Returns", "the", "fully", "qualified", "name", "of", "the", "class", "that", "the", "specified", "class", "extends", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L672-L694
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFQClassNameFromDoubleColonToken
public function getFQClassNameFromDoubleColonToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_DOUBLE_COLO...
php
public function getFQClassNameFromDoubleColonToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } if ($tokens[$stackPtr]['code'] !== \T_DOUBLE_COLO...
[ "public", "function", "getFQClassNameFromDoubleColonToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", ...
Returns the class name for the static usage of a class. This can be a call to a method, the use of a property or constant. Returns an empty string if the class name could not be reliably inferred. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of a...
[ "Returns", "the", "class", "name", "for", "the", "static", "usage", "of", "a", "class", ".", "This", "can", "be", "a", "call", "to", "a", "method", "the", "use", "of", "a", "property", "or", "constant", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L708-L758
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getFQName
public function getFQName(File $phpcsFile, $stackPtr, $name) { if (strpos($name, '\\') === 0) { // Already fully qualified. return $name; } // Remove the namespace keyword if used. if (strpos($name, 'namespace\\') === 0) { $name = substr($name, 10...
php
public function getFQName(File $phpcsFile, $stackPtr, $name) { if (strpos($name, '\\') === 0) { // Already fully qualified. return $name; } // Remove the namespace keyword if used. if (strpos($name, 'namespace\\') === 0) { $name = substr($name, 10...
[ "public", "function", "getFQName", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "name", ")", "{", "if", "(", "strpos", "(", "$", "name", ",", "'\\\\'", ")", "===", "0", ")", "{", "// Already fully qualified.", "return", "$", "name", "...
Get the Fully Qualified name for a class/function/constant etc. Checks if a class/function/constant name is already fully qualified and if not, enrich it with the relevant namespace information. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the...
[ "Get", "the", "Fully", "Qualified", "name", "for", "a", "class", "/", "function", "/", "constant", "etc", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L773-L792
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.determineNamespace
public function determineNamespace(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } // Check for scoped namespace {}. if (empty($tokens[$stac...
php
public function determineNamespace(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return ''; } // Check for scoped namespace {}. if (empty($tokens[$stac...
[ "public", "function", "determineNamespace", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$", "tokens...
Determine the namespace name an arbitrary token lives in. @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. @param int $stackPtr The token position for which to determine the namespace. @return string Namespace name or empty string if it couldn't be determined or no namespace applies.
[ "Determine", "the", "namespace", "name", "an", "arbitrary", "token", "lives", "in", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L821-L871
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getDeclaredNamespaceName
public function getDeclaredNamespaceName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if ($stackPtr === false || isset($tokens[$stackPtr]) === false) { return false; } if ($tokens[$stackPtr]['code'] !=...
php
public function getDeclaredNamespaceName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if ($stackPtr === false || isset($tokens[$stackPtr]) === false) { return false; } if ($tokens[$stackPtr]['code'] !=...
[ "public", "function", "getDeclaredNamespaceName", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "$", "stackPtr", "==="...
Get the complete namespace name for a namespace declaration. For hierarchical namespaces, the name will be composed of several tokens, i.e. MyProject\Sub\Level which will be returned together as one string. @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. @param int|bool $stackPtr The posi...
[ "Get", "the", "complete", "namespace", "name", "for", "a", "namespace", "declaration", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L885-L924
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getReturnTypeHintToken
public function getReturnTypeHintToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) { return $stackPtr; } if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stack...
php
public function getReturnTypeHintToken(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (\defined('T_RETURN_TYPE') && $tokens[$stackPtr]['code'] === \T_RETURN_TYPE) { return $stackPtr; } if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stack...
[ "public", "function", "getReturnTypeHintToken", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "\\", "defined", "(", "'T_RETURN_TYPE'", ")", "&&", "$", "to...
Get the stack pointer for a return type token for a given function. Compatible layer for older PHPCS versions which don't recognize return type hints correctly. Expects to be passed T_RETURN_TYPE, T_FUNCTION or T_CLOSURE token. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int ...
[ "Get", "the", "stack", "pointer", "for", "a", "return", "type", "token", "for", "a", "given", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L942-L1000
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getReturnTypeHintName
public function getReturnTypeHintName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE. $colon = $phpcsFile->findPrevious(array(\T_COLON, \T_INLINE_ELSE, \T_FUNCTION, \T_CLO...
php
public function getReturnTypeHintName(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // In older PHPCS versions, the nullable indicator will turn a return type colon into a T_INLINE_ELSE. $colon = $phpcsFile->findPrevious(array(\T_COLON, \T_INLINE_ELSE, \T_FUNCTION, \T_CLO...
[ "public", "function", "getReturnTypeHintName", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// In older PHPCS versions, the nullable indicator will turn a return type colon into a T...
Get the complete return type declaration for a given function. Cross-version compatible way to retrieve the complete return type declaration. For a classname-based return type, PHPCS, as well as the Sniff::getReturnTypeHintToken() method will mark the classname as the return type token. This method will find preceedi...
[ "Get", "the", "complete", "return", "type", "declaration", "for", "a", "given", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1021-L1055
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isClassProperty
public function isClassProperty(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) { return false; } // Note: interfaces can not declare properties. $validScopes...
php
public function isClassProperty(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_VARIABLE) { return false; } // Note: interfaces can not declare properties. $validScopes...
[ "public", "function", "isClassProperty", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "isset", "(", "$", "tokens", "[", "$", "stackPtr", "]", ")", "=...
Check whether a T_VARIABLE token is a class property declaration. Compatibility layer for PHPCS cross-version compatibility as PHPCS 2.4.0 - 2.7.1 does not have good enough support for anonymous classes. Along the same lines, the`getMemberProperties()` method does not support the `var` prefix. @param \PHP_CodeSniffer...
[ "Check", "whether", "a", "T_VARIABLE", "token", "is", "a", "class", "property", "declaration", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1072-L1105
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isClassConstant
public function isClassConstant(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) { return false; } // Note: traits can not declare constants. $validScopes = array...
php
public function isClassConstant(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]) === false || $tokens[$stackPtr]['code'] !== \T_CONST) { return false; } // Note: traits can not declare constants. $validScopes = array...
[ "public", "function", "isClassConstant", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "isset", "(", "$", "tokens", "[", "$", "stackPtr", "]", ")", "=...
Check whether a T_CONST token is a class constant declaration. @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. @param int $stackPtr The position in the stack of the T_CONST token to verify. @return bool
[ "Check", "whether", "a", "T_CONST", "token", "is", "a", "class", "constant", "declaration", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1117-L1136
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.validDirectScope
protected function validDirectScope(File $phpcsFile, $stackPtr, $validScopes) { $tokens = $phpcsFile->getTokens(); if (empty($tokens[$stackPtr]['conditions']) === true) { return false; } /* * Check only the direct wrapping scope of the token. */ ...
php
protected function validDirectScope(File $phpcsFile, $stackPtr, $validScopes) { $tokens = $phpcsFile->getTokens(); if (empty($tokens[$stackPtr]['conditions']) === true) { return false; } /* * Check only the direct wrapping scope of the token. */ ...
[ "protected", "function", "validDirectScope", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "validScopes", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "empty", "(", "$", "tokens", "[", "$...
Check whether the direct wrapping scope of a token is within a limited set of acceptable tokens. Used to check, for instance, if a T_CONST is a class constant. @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. @param int $stackPtr The position in the stack of the T_CONST token to v...
[ "Check", "whether", "the", "direct", "wrapping", "scope", "of", "a", "token", "is", "within", "a", "limited", "set", "of", "acceptable", "tokens", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1155-L1178
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getTypeHintsFromFunctionDeclaration
public function getTypeHintsFromFunctionDeclaration(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) { return array(); } $parameters = PHPCSHelper::getMethodPara...
php
public function getTypeHintsFromFunctionDeclaration(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); if ($tokens[$stackPtr]['code'] !== \T_FUNCTION && $tokens[$stackPtr]['code'] !== \T_CLOSURE) { return array(); } $parameters = PHPCSHelper::getMethodPara...
[ "public", "function", "getTypeHintsFromFunctionDeclaration", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "if", "(", "$", "tokens", "[", "$", "stackPtr", "]", "[", ...
Get an array of just the type hints from a function declaration. Expects to be passed T_FUNCTION or T_CLOSURE token. Strips potential nullable indicator and potential global namespace indicator from the type hints before returning them. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int ...
[ "Get", "an", "array", "of", "just", "the", "type", "hints", "from", "a", "function", "declaration", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1197-L1229
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.getHashAlgorithmParameter
public function getHashAlgorithmParameter(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } if ($tokens[$stackPtr]['code'] !== \T_STRING) { ...
php
public function getHashAlgorithmParameter(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } if ($tokens[$stackPtr]['code'] !== \T_STRING) { ...
[ "public", "function", "getHashAlgorithmParameter", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$", ...
Get the hash algorithm name from the parameter in a hash function call. @param \PHP_CodeSniffer_File $phpcsFile Instance of phpcsFile. @param int $stackPtr The position of the T_STRING function token. @return string|false The algorithm name without quotes if this was a relevant hash function call o...
[ "Get", "the", "hash", "algorithm", "name", "from", "the", "parameter", "in", "a", "hash", "function", "call", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1241-L1273
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isUseOfGlobalConstant
public function isUseOfGlobalConstant(File $phpcsFile, $stackPtr) { static $isLowPHPCS, $isLowPHP; $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of t...
php
public function isUseOfGlobalConstant(File $phpcsFile, $stackPtr) { static $isLowPHPCS, $isLowPHP; $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of t...
[ "public", "function", "isUseOfGlobalConstant", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "static", "$", "isLowPHPCS", ",", "$", "isLowPHP", ";", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the ex...
Determine whether an arbitrary T_STRING token is the use of a global constant. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the function call token. @return bool
[ "Determine", "whether", "an", "arbitrary", "T_STRING", "token", "is", "the", "use", "of", "a", "global", "constant", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1284-L1399
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isPositiveNumber
public function isPositiveNumber(File $phpcsFile, $start, $end, $allowFloats = false) { $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats); if ($number === false) { return false; } return ($number > 0); }
php
public function isPositiveNumber(File $phpcsFile, $start, $end, $allowFloats = false) { $number = $this->isNumber($phpcsFile, $start, $end, $allowFloats); if ($number === false) { return false; } return ($number > 0); }
[ "public", "function", "isPositiveNumber", "(", "File", "$", "phpcsFile", ",", "$", "start", ",", "$", "end", ",", "$", "allowFloats", "=", "false", ")", "{", "$", "number", "=", "$", "this", "->", "isNumber", "(", "$", "phpcsFile", ",", "$", "start", ...
Determine whether the tokens between $start and $end together form a positive number as recognized by PHP. The outcome of this function is reliable for `true`, `false` should be regarded as "undetermined". Note: Zero is *not* regarded as a positive number. @param \PHP_CodeSniffer_File $phpcsFile The file being sca...
[ "Determine", "whether", "the", "tokens", "between", "$start", "and", "$end", "together", "form", "a", "positive", "number", "as", "recognized", "by", "PHP", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1422-L1431
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isNumber
protected function isNumber(File $phpcsFile, $start, $end, $allowFloats = false) { $stringTokens = Tokens::$heredocTokens + Tokens::$stringTokens; $validTokens = array(); $validTokens[\T_LNUMBER] = true; $validTokens[\T_TRUE] = true; // Evaluates to int 1. $v...
php
protected function isNumber(File $phpcsFile, $start, $end, $allowFloats = false) { $stringTokens = Tokens::$heredocTokens + Tokens::$stringTokens; $validTokens = array(); $validTokens[\T_LNUMBER] = true; $validTokens[\T_TRUE] = true; // Evaluates to int 1. $v...
[ "protected", "function", "isNumber", "(", "File", "$", "phpcsFile", ",", "$", "start", ",", "$", "end", ",", "$", "allowFloats", "=", "false", ")", "{", "$", "stringTokens", "=", "Tokens", "::", "$", "heredocTokens", "+", "Tokens", "::", "$", "stringToke...
Determine whether the tokens between $start and $end together form a number as recognized by PHP. The outcome of this function is reliable for "true-ish" values, `false` should be regarded as "undetermined". @link https://3v4l.org/npTeM Mainly intended for examining variable assignments, function call parameters, ar...
[ "Determine", "whether", "the", "tokens", "between", "$start", "and", "$end", "together", "form", "a", "number", "as", "recognized", "by", "PHP", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1491-L1639
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isNumericCalculation
protected function isNumericCalculation(File $phpcsFile, $start, $end) { $arithmeticTokens = Tokens::$arithmeticTokens; // phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound if (\defined('T_POW') && isset($arithmeticTokens[\T_POW]) === false) { // T_POW was not add...
php
protected function isNumericCalculation(File $phpcsFile, $start, $end) { $arithmeticTokens = Tokens::$arithmeticTokens; // phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound if (\defined('T_POW') && isset($arithmeticTokens[\T_POW]) === false) { // T_POW was not add...
[ "protected", "function", "isNumericCalculation", "(", "File", "$", "phpcsFile", ",", "$", "start", ",", "$", "end", ")", "{", "$", "arithmeticTokens", "=", "Tokens", "::", "$", "arithmeticTokens", ";", "// phpcs:disable PHPCompatibility.Constants.NewConstants.t_powFound...
Determine whether the tokens between $start and $end together form a numberic calculation as recognized by PHP. The outcome of this function is reliable for `true`, `false` should be regarded as "undetermined". Mainly intended for examining variable assignments, function call parameters, array values where the start ...
[ "Determine", "whether", "the", "tokens", "between", "$start", "and", "$end", "together", "form", "a", "numberic", "calculation", "as", "recognized", "by", "PHP", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1659-L1722
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isShortList
public function isShortList(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of the tokens this function handles ? if ($tok...
php
public function isShortList(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); // Check for the existence of the token. if (isset($tokens[$stackPtr]) === false) { return false; } // Is this one of the tokens this function handles ? if ($tok...
[ "public", "function", "isShortList", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "// Check for the existence of the token.", "if", "(", "isset", "(", "$", "tokens", "[...
Determine whether a T_OPEN/CLOSE_SHORT_ARRAY token is a list() construct. Note: A variety of PHPCS versions have bugs in the tokenizing of short arrays. In that case, the tokens are identified as T_OPEN/CLOSE_SQUARE_BRACKET. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int ...
[ "Determine", "whether", "a", "T_OPEN", "/", "CLOSE_SHORT_ARRAY", "token", "is", "a", "list", "()", "construct", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1736-L1868
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniff.php
Sniff.isVariable
public function isVariable(File $phpcsFile, $start, $end, $targetNestingLevel) { static $tokenBlackList, $bracketTokens; // Create the token arrays only once. if (isset($tokenBlackList, $bracketTokens) === false) { $tokenBlackList = array( \T_OPEN_PARENTHESIS =...
php
public function isVariable(File $phpcsFile, $start, $end, $targetNestingLevel) { static $tokenBlackList, $bracketTokens; // Create the token arrays only once. if (isset($tokenBlackList, $bracketTokens) === false) { $tokenBlackList = array( \T_OPEN_PARENTHESIS =...
[ "public", "function", "isVariable", "(", "File", "$", "phpcsFile", ",", "$", "start", ",", "$", "end", ",", "$", "targetNestingLevel", ")", "{", "static", "$", "tokenBlackList", ",", "$", "bracketTokens", ";", "// Create the token arrays only once.", "if", "(", ...
Determine whether the tokens between $start and $end could together represent a variable. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $start Starting point stack pointer. Inclusive. I.e. this token should be taken into account. @param int ...
[ "Determine", "whether", "the", "tokens", "between", "$start", "and", "$end", "could", "together", "represent", "a", "variable", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniff.php#L1883-L1957
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php
NonStaticMagicMethodsSniff.process
public function process(File $phpcsFile, $stackPtr) { // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it. if ($this->supportsAbove('5.3') === false) { return; } $tokens = $phpcsFile->getTokens(); if (iss...
php
public function process(File $phpcsFile, $stackPtr) { // Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it. if ($this->supportsAbove('5.3') === false) { return; } $tokens = $phpcsFile->getTokens(); if (iss...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "// Should be removed, the requirement was previously also there, 5.3 just started throwing a warning about it.", "if", "(", "$", "this", "->", "supportsAbove", "(", "'5.3'", ")"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/NonStaticMagicMethodsSniff.php#L109-L177
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php
NewUseConstFunctionSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.5') !== true) { return; } $tokens = $phpcsFile->getTokens(); $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($nextNonEmpty === false) {...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.5') !== true) { return; } $tokens = $phpcsFile->getTokens(); $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($nextNonEmpty === false) {...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.5'", ")", "!==", "true", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->",...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/UseDeclarations/NewUseConstFunctionSniff.php#L64-L101
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php
ForbiddenVariableNamesInClosureUseSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.1') === false) { return; } $tokens = $phpcsFile->getTokens(); // Verify this use statement is used with a closure - if so, it has to have parenthesis before it. $previousNonEmpty =...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.1') === false) { return; } $tokens = $phpcsFile->getTokens(); // Verify this use statement is used with a closure - if so, it has to have parenthesis before it. $previousNonEmpty =...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.1'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenVariableNamesInClosureUseSniff.php#L53-L117
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php
RemovedNamespacedAssertSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.3') === false) { return; } $funcName = $phpcsFile->getDeclarationName($stackPtr); if (strtolower($funcName) !== 'assert') { return; } if ($phpcsFile->hasCondit...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.3') === false) { return; } $funcName = $phpcsFile->getDeclarationName($stackPtr); if (strtolower($funcName) !== 'assert') { return; } if ($phpcsFile->hasCondit...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.3'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "funcName", "=", "$", "phpcsFile", "-...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionNameRestrictions/RemovedNamespacedAssertSniff.php#L69-L91
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php
ForbiddenGetClassNullSniff.processParameters
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { if (isset($parameters[1]) === false) { return; } if ($parameters[1]['raw'] !== 'null') { return; } $phpcsFile->addError( 'Passing "null" as the $o...
php
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { if (isset($parameters[1]) === false) { return; } if ($parameters[1]['raw'] !== 'null') { return; } $phpcsFile->addError( 'Passing "null" as the $o...
[ "public", "function", "processParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "functionName", ",", "$", "parameters", ")", "{", "if", "(", "isset", "(", "$", "parameters", "[", "1", "]", ")", "===", "false", ")", "{", "retur...
Process the parameters of a matched function. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack. @param string $functionName The token content (function name) which was matched. @param array ...
[ "Process", "the", "parameters", "of", "a", "matched", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/ForbiddenGetClassNullSniff.php#L64-L79
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php
ForbiddenParametersWithSameNameSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $token = $tokens[$stackPtr]; // Skip function without body. if (isset($token['scope_opener']) === false) { ...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsAbove('7.0') === false) { return; } $tokens = $phpcsFile->getTokens(); $token = $tokens[$stackPtr]; // Skip function without body. if (isset($token['scope_opener']) === false) { ...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsAbove", "(", "'7.0'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionDeclarations/ForbiddenParametersWithSameNameSniff.php#L54-L85
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php
NewHeredocSniff.isValidAssignment
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) { $tokens = $phpcsFile->getTokens(); $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { // No value assigned. ...
php
protected function isValidAssignment(File $phpcsFile, $stackPtr, $end) { $tokens = $phpcsFile->getTokens(); $next = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), $end, true); if ($next === false || $tokens[$next]['code'] !== \T_EQUAL) { // No value assigned. ...
[ "protected", "function", "isValidAssignment", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "end", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "next", "=", "$", "phpcsFile", "->", "findNext", ...
Is a value declared and does the declared value not contain an heredoc ? @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @param int $end The end of the value definition. @r...
[ "Is", "a", "value", "declared", "and", "does", "the", "declared", "value", "not", "contain", "an", "heredoc", "?" ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/InitialValue/NewHeredocSniff.php#L79-L89
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php
NewFunctionParametersSniff.getErrorInfo
public function getErrorInfo(array $itemArray, array $itemInfo) { $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); $errorInfo['paramName'] = $itemArray['name']; return $errorInfo; }
php
public function getErrorInfo(array $itemArray, array $itemInfo) { $errorInfo = parent::getErrorInfo($itemArray, $itemInfo); $errorInfo['paramName'] = $itemArray['name']; return $errorInfo; }
[ "public", "function", "getErrorInfo", "(", "array", "$", "itemArray", ",", "array", "$", "itemInfo", ")", "{", "$", "errorInfo", "=", "parent", "::", "getErrorInfo", "(", "$", "itemArray", ",", "$", "itemInfo", ")", ";", "$", "errorInfo", "[", "'paramName'...
Retrieve the relevant detail (version) information for use in an error message. @param array $itemArray Version and other information about the item. @param array $itemInfo Base information about the item. @return array
[ "Retrieve", "the", "relevant", "detail", "(", "version", ")", "information", "for", "use", "in", "an", "error", "message", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php#L1025-L1031
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php
NewFunctionParametersSniff.filterErrorData
protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { array_shift($data); array_unshift($data, $itemInfo['name'], $errorInfo['paramName']); return $data; }
php
protected function filterErrorData(array $data, array $itemInfo, array $errorInfo) { array_shift($data); array_unshift($data, $itemInfo['name'], $errorInfo['paramName']); return $data; }
[ "protected", "function", "filterErrorData", "(", "array", "$", "data", ",", "array", "$", "itemInfo", ",", "array", "$", "errorInfo", ")", "{", "array_shift", "(", "$", "data", ")", ";", "array_unshift", "(", "$", "data", ",", "$", "itemInfo", "[", "'nam...
Allow for concrete child classes to filter the error data before it's passed to PHPCS. @param array $data The error data array which was created. @param array $itemInfo Base information about the item this error message applies to. @param array $errorInfo Detail information about an item this error message appli...
[ "Allow", "for", "concrete", "child", "classes", "to", "filter", "the", "error", "data", "before", "it", "s", "passed", "to", "PHPCS", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/NewFunctionParametersSniff.php#L1068-L1073
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php
OptionalToRequiredFunctionParametersSniff.addError
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) { $error = 'The "%s" parameter for function %s() is missing. Passing this parameter is '; if ($errorInfo['optionalRecommended'] === '') { $error .= 'no longer optional. The optional nature of the para...
php
public function addError(File $phpcsFile, $stackPtr, array $itemInfo, array $errorInfo) { $error = 'The "%s" parameter for function %s() is missing. Passing this parameter is '; if ($errorInfo['optionalRecommended'] === '') { $error .= 'no longer optional. The optional nature of the para...
[ "public", "function", "addError", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "array", "$", "itemInfo", ",", "array", "$", "errorInfo", ")", "{", "$", "error", "=", "'The \"%s\" parameter for function %s() is missing. Passing this parameter is '", ";", ...
Generates the error or warning for this item. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the relevant token in the stack. @param array $itemInfo Base information about the item. @param array $errorInfo Array w...
[ "Generates", "the", "error", "or", "warning", "for", "this", "item", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/FunctionUse/OptionalToRequiredFunctionParametersSniff.php#L121-L158
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php
NewForeachExpressionReferencingSniff.process
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return;...
php
public function process(File $phpcsFile, $stackPtr) { if ($this->supportsBelow('5.4') === false) { return; } $tokens = $phpcsFile->getTokens(); if (isset($tokens[$stackPtr]['parenthesis_opener'], $tokens[$stackPtr]['parenthesis_closer']) === false) { return;...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "if", "(", "$", "this", "->", "supportsBelow", "(", "'5.4'", ")", "===", "false", ")", "{", "return", ";", "}", "$", "tokens", "=", "$", "phpcsFile", "->"...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ControlStructures/NewForeachExpressionReferencingSniff.php#L51-L95
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php
RemovedMbstringModifiersSniff.processParameters
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { $tokens = $phpcsFile->getTokens(); $functionNameLc = strtolower($functionName); // Check whether the options parameter in the function call is passed. if (isset($parameters[$this->tar...
php
public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters) { $tokens = $phpcsFile->getTokens(); $functionNameLc = strtolower($functionName); // Check whether the options parameter in the function call is passed. if (isset($parameters[$this->tar...
[ "public", "function", "processParameters", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ",", "$", "functionName", ",", "$", "parameters", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "functionNameLc", "=", ...
Process the parameters of a matched function. This method has to be made concrete in child classes. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack. @param string $functionName The token content...
[ "Process", "the", "parameters", "of", "a", "matched", "function", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/ParameterValues/RemovedMbstringModifiersSniff.php#L72-L121
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php
NewFlexibleHeredocNowdocSniff.register
public function register() { $targets = array( \T_END_HEREDOC, \T_END_NOWDOC, ); if (version_compare(\PHP_VERSION_ID, '70299', '>') === false) { // Start identifier of a PHP 7.3 flexible heredoc/nowdoc. $targets[] = \T_STRING; } ...
php
public function register() { $targets = array( \T_END_HEREDOC, \T_END_NOWDOC, ); if (version_compare(\PHP_VERSION_ID, '70299', '>') === false) { // Start identifier of a PHP 7.3 flexible heredoc/nowdoc. $targets[] = \T_STRING; } ...
[ "public", "function", "register", "(", ")", "{", "$", "targets", "=", "array", "(", "\\", "T_END_HEREDOC", ",", "\\", "T_END_NOWDOC", ",", ")", ";", "if", "(", "version_compare", "(", "\\", "PHP_VERSION_ID", ",", "'70299'", ",", "'>'", ")", "===", "false...
Returns an array of tokens this test wants to listen for. @return array
[ "Returns", "an", "array", "of", "tokens", "this", "test", "wants", "to", "listen", "for", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php#L41-L54
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php
NewFlexibleHeredocNowdocSniff.process
public function process(File $phpcsFile, $stackPtr) { /* * Due to a tokenizer bug which gets hit when the PHP 7.3 heredoc/nowdoc syntax * is used, this part of the sniff cannot possibly work on PHPCS < 2.6.0. * See upstream issue #928. */ if ($this->supportsBelow(...
php
public function process(File $phpcsFile, $stackPtr) { /* * Due to a tokenizer bug which gets hit when the PHP 7.3 heredoc/nowdoc syntax * is used, this part of the sniff cannot possibly work on PHPCS < 2.6.0. * See upstream issue #928. */ if ($this->supportsBelow(...
[ "public", "function", "process", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "/*\n * Due to a tokenizer bug which gets hit when the PHP 7.3 heredoc/nowdoc syntax\n * is used, this part of the sniff cannot possibly work on PHPCS < 2.6.0.\n * See upst...
Processes this test, when one of its tokens is encountered. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Processes", "this", "test", "when", "one", "of", "its", "tokens", "is", "encountered", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php#L66-L81
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php
NewFlexibleHeredocNowdocSniff.detectIndentedNonStandAloneClosingMarker
protected function detectIndentedNonStandAloneClosingMarker(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $indentError = 'Heredoc/nowdoc with an indented closing marker is not supported in PHP 7.2 or earlier.'; $indentErrorCode = 'IndentedClosingMarker';...
php
protected function detectIndentedNonStandAloneClosingMarker(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $indentError = 'Heredoc/nowdoc with an indented closing marker is not supported in PHP 7.2 or earlier.'; $indentErrorCode = 'IndentedClosingMarker';...
[ "protected", "function", "detectIndentedNonStandAloneClosingMarker", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "indentError", "=", "'Heredoc/nowdoc with an indented clo...
Detect indented and/or non-stand alone closing markers. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Detect", "indented", "and", "/", "or", "non", "-", "stand", "alone", "closing", "markers", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php#L93-L168
PHPCompatibility/PHPCompatibility
PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php
NewFlexibleHeredocNowdocSniff.detectClosingMarkerInBody
protected function detectClosingMarkerInBody(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $error = 'The body of a heredoc/nowdoc can not contain the heredoc/nowdoc closing marker as text at the start of a line since PHP 7.3.'; $errorCode = 'ClosingMarkerNoNewLine';...
php
protected function detectClosingMarkerInBody(File $phpcsFile, $stackPtr) { $tokens = $phpcsFile->getTokens(); $error = 'The body of a heredoc/nowdoc can not contain the heredoc/nowdoc closing marker as text at the start of a line since PHP 7.3.'; $errorCode = 'ClosingMarkerNoNewLine';...
[ "protected", "function", "detectClosingMarkerInBody", "(", "File", "$", "phpcsFile", ",", "$", "stackPtr", ")", "{", "$", "tokens", "=", "$", "phpcsFile", "->", "getTokens", "(", ")", ";", "$", "error", "=", "'The body of a heredoc/nowdoc can not contain the heredoc...
Detect heredoc/nowdoc identifiers at the start of lines in the heredoc/nowdoc body. @param \PHP_CodeSniffer_File $phpcsFile The file being scanned. @param int $stackPtr The position of the current token in the stack passed in $tokens. @return void
[ "Detect", "heredoc", "/", "nowdoc", "identifiers", "at", "the", "start", "of", "lines", "in", "the", "heredoc", "/", "nowdoc", "body", "." ]
train
https://github.com/PHPCompatibility/PHPCompatibility/blob/8451ac21d652156e6742bbada166d28503ef67e4/PHPCompatibility/Sniffs/Syntax/NewFlexibleHeredocNowdocSniff.php#L180-L246