class MemberVarScopeSniff
Hierarchy
- class \PHP_CodeSniffer\Sniffs\AbstractScopeSniff implements \PHP_CodeSniffer\Sniffs\Sniff
- class \PHP_CodeSniffer\Sniffs\AbstractVariableSniff extends \PHP_CodeSniffer\Sniffs\AbstractScopeSniff
- class \PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope\MemberVarScopeSniff extends \PHP_CodeSniffer\Sniffs\AbstractVariableSniff
- class \PHP_CodeSniffer\Sniffs\AbstractVariableSniff extends \PHP_CodeSniffer\Sniffs\AbstractScopeSniff
Expanded class hierarchy of MemberVarScopeSniff
File
-
vendor/
squizlabs/ php_codesniffer/ src/ Standards/ Squiz/ Sniffs/ Scope/ MemberVarScopeSniff.php, line 15
Namespace
PHP_CodeSniffer\Standards\Squiz\Sniffs\ScopeView source
class MemberVarScopeSniff extends AbstractVariableSniff {
/**
* Processes the function tokens within the class.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
* @param int $stackPtr The position where the token was found.
*
* @return void
*/
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);
}
//end processMemberVar()
/**
* Processes normal variables.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
* @param int $stackPtr The position where the token was found.
*
* @return void
*/
protected function processVariable(File $phpcsFile, $stackPtr) {
/*
We don't care about normal variables.
*/
}
//end processVariable()
/**
* Processes variables in double quoted strings.
*
* @param \PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.
* @param int $stackPtr The position where the token was found.
*
* @return void
*/
protected function processVariableInString(File $phpcsFile, $stackPtr) {
/*
We don't care about normal variables.
*/
}
//end processVariableInString()
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overriden Title |
---|---|---|---|---|
AbstractScopeSniff::$listenOutside | private | property | True if this test should fire on tokens outside of the scope. | |
AbstractScopeSniff::$scopeTokens | private | property | The type of scope opener tokens that this test wishes to listen to. | |
AbstractScopeSniff::$tokens | private | property | The token types that this test wishes to listen to within the scope. | |
AbstractScopeSniff::process | final public | function | Processes the tokens that this test is listening for. | Overrides Sniff::process |
AbstractScopeSniff::register | final public | function | The method that is called to register the tokens this test wishes to listen to. |
Overrides Sniff::register |
AbstractVariableSniff::$phpReservedVars | protected | property | List of PHP Reserved variables. | |
AbstractVariableSniff::processTokenOutsideScope | final protected | function | Processes the token outside the scope in the file. | Overrides AbstractScopeSniff::processTokenOutsideScope |
AbstractVariableSniff::processTokenWithinScope | final protected | function | Processes the token in the specified PHP_CodeSniffer\Files\File. | Overrides AbstractScopeSniff::processTokenWithinScope |
AbstractVariableSniff::__construct | public | function | Constructs an AbstractVariableTest. | Overrides AbstractScopeSniff::__construct |
MemberVarScopeSniff::processMemberVar | protected | function | Processes the function tokens within the class. | Overrides AbstractVariableSniff::processMemberVar |
MemberVarScopeSniff::processVariable | protected | function | Processes normal variables. | Overrides AbstractVariableSniff::processVariable |
MemberVarScopeSniff::processVariableInString | protected | function | Processes variables in double quoted strings. | Overrides AbstractVariableSniff::processVariableInString |