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

Breadcrumb

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

function MemberVarScopeSniff::processMemberVar

Processes the function tokens within the class.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.:

int $stackPtr The position where the token was found.:

Return value

void

Overrides AbstractVariableSniff::processMemberVar

File

vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Scope/MemberVarScopeSniff.php, line 27

Class

MemberVarScopeSniff

Namespace

PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope

Code

protected function processMemberVar(File $phpcsFile, $stackPtr) {
    $tokens = $phpcsFile->getTokens();
    $properties = $phpcsFile->getMemberProperties($stackPtr);
    if ($properties === [] || $properties['scope_specified'] !== false) {
        return;
    }
    $error = 'Scope modifier not specified for member variable "%s"';
    $data = [
        $tokens[$stackPtr]['content'],
    ];
    $phpcsFile->addError($error, $stackPtr, 'Missing', $data);
}
RSS feed
Powered by Drupal