Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. SelfMemberReferenceSniff.php

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

SelfMemberReferenceSniff

Namespace

PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes

Code

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);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal