PHP Class Squiz_Sniffs_Classes_SelfMemberReferenceSniff, PHP_CodeSniffer

Verifies that :
  • self:: is used instead of Self::
  • self:: is used for local static member reference
  • self:: is used instead of self ::
Author: Greg Sherwood ([email protected])
Author: Marc McIntyre ([email protected])
Inheritance: extends PHP_CodeSniffer_Standards_AbstractScopeSniff
Show file Open project: squizlabs/php_codesniffer

Public Methods

Method Description
__construct ( ) Constructs a Squiz_Sniffs_Classes_SelfMemberReferenceSniff.

Protected Methods

Method Description
getDeclarationNameWithNamespace ( array $tokens, integer $stackPtr ) : string Returns the declaration names for classes/interfaces/functions with a namespace.
getNamespaceOfScope ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : string Returns the namespace declaration of a file.
processTokenWithinScope ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr, integer $currScope ) : void Processes the function tokens within the class.

Method Details

__construct() public method

Constructs a Squiz_Sniffs_Classes_SelfMemberReferenceSniff.
public __construct ( )

getDeclarationNameWithNamespace() protected method

Returns the declaration names for classes/interfaces/functions with a namespace.
protected getDeclarationNameWithNamespace ( array $tokens, integer $stackPtr ) : string
$tokens array Token stack for this file
$stackPtr integer The position where the namespace building will start.
return string

getNamespaceOfScope() protected method

Returns the namespace declaration of a file.
protected getNamespaceOfScope ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : string
$phpcsFile PHP_CodeSniffer_File The file where this token was found.
$stackPtr integer The position where the search for the namespace declaration will start.
return string

processTokenWithinScope() protected method

Processes the function tokens within the class.
protected processTokenWithinScope ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr, integer $currScope ) : void
$phpcsFile PHP_CodeSniffer_File The file where this token was found.
$stackPtr integer The position where the token was found.
$currScope integer The current scope opener token.
return void