Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7437393
MemberVarScopeSniff.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
MemberVarScopeSniff.php
View Options
<?php
/**
* Verifies that class members have scope modifiers.
*
* @author Greg Sherwood <gsherwood@squiz.net>
* @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
* @license https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/
namespace
PHP_CodeSniffer\Standards\Squiz\Sniffs\Scope
;
use
PHP_CodeSniffer\Files\File
;
use
PHP_CodeSniffer\Sniffs\AbstractVariableSniff
;
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()
}
//end class
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 13:58 (4 h, 44 m ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e9/9a/c0b7d90df0fb6a4d0a21c811217d
Default Alt Text
MemberVarScopeSniff.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment