function SelfMemberReferenceSniff::getDeclarationNameWithNamespace
Returns the declaration names for classes/interfaces/functions with a namespace.
Parameters
array $tokens Token stack for this file.:
int $stackPtr The position where the namespace building will start.:
Return value
string
2 calls to SelfMemberReferenceSniff::getDeclarationNameWithNamespace()
- SelfMemberReferenceSniff::getNamespaceOfScope in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ Classes/ SelfMemberReferenceSniff.php - Returns the namespace declaration of a file.
- SelfMemberReferenceSniff::processTokenWithinScope in vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ Classes/ SelfMemberReferenceSniff.php - Processes the function tokens within the class.
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ Classes/ SelfMemberReferenceSniff.php, line 190
Class
Namespace
PHP_CodeSniffer\Standards\Squiz\Sniffs\ClassesCode
protected function getDeclarationNameWithNamespace(array $tokens, $stackPtr) {
$nameParts = [];
$currentPointer = $stackPtr;
while ($tokens[$currentPointer]['code'] === T_NS_SEPARATOR || $tokens[$currentPointer]['code'] === T_STRING || isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true) {
if (isset(Tokens::$emptyTokens[$tokens[$currentPointer]['code']]) === true) {
--$currentPointer;
continue;
}
$nameParts[] = $tokens[$currentPointer]['content'];
--$currentPointer;
}
$nameParts = array_reverse($nameParts);
return implode('', $nameParts);
}