function ConstructorNameSniff::loadFunctionNamesInScope
Extracts all the function names found in the given scope.
Parameters
\PHP_CodeSniffer\Files\File $phpcsFile The current file being scanned.:
int $currScope A pointer to the start of the scope.:
Return value
void
1 call to ConstructorNameSniff::loadFunctionNamesInScope()
- ConstructorNameSniff::processTokenWithinScope in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Generic/ Sniffs/ NamingConventions/ ConstructorNameSniff.php - Processes this test when one of its tokens is encountered.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Generic/ Sniffs/ NamingConventions/ ConstructorNameSniff.php, line 157
Class
Namespace
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventionsCode
protected function loadFunctionNamesInScope(File $phpcsFile, $currScope) {
$this->functionList = [];
$tokens = $phpcsFile->getTokens();
for ($i = $tokens[$currScope]['scope_opener'] + 1; $i < $tokens[$currScope]['scope_closer']; $i++) {
if ($tokens[$i]['code'] !== T_FUNCTION) {
continue;
}
$this->functionList[] = trim(strtolower($phpcsFile->getDeclarationName($i)));
if (isset($tokens[$i]['scope_closer']) !== false) {
// Skip past nested functions and such.
$i = $tokens[$i]['scope_closer'];
}
}
}