PHP Class CakePHP_Sniffs_NamingConventions_ValidVariableNameSniff

Inheritance: extends PHP_CodeSniffer_Standards_AbstractVariableSniff
Show file Open project: cakephp/cakephp-codesniffer

Protected Methods

Method Description
_fixVar ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr, string $varName ) : void
_isValidVar ( string $string, boolean $public = true ) : boolean Check that a variable is a valid shape.
processMemberVar ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void Processes class member variables.
processVariable ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void Processes this test, when one of its tokens is encountered.
processVariableInString ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void Processes the variable found within a double quoted string.

Method Details

_fixVar() protected method

protected _fixVar ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr, string $varName ) : void
$phpcsFile PHP_CodeSniffer_File PHPCS file
$stackPtr integer The pointer
$varName string The variable name
return void

_isValidVar() protected method

Variables in CakePHP can either be $fooBar, $FooBar, $_fooBar, or $_FooBar.
protected _isValidVar ( string $string, boolean $public = true ) : boolean
$string string The variable to check.
$public boolean Whether or not the variable is public.
return boolean

processMemberVar() protected method

Processes class member variables.
protected processMemberVar ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
return void

processVariable() protected method

Processes variables, we skip processing object properties because they could come from things like PDO which doesn't follow the normal conventions and causes additional failures.
protected processVariable ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the current token in the stack passed in $tokens.
return void

processVariableInString() protected method

Processes the variable found within a double quoted string.
protected processVariableInString ( PHP_CodeSniffer_File $phpcsFile, integer $stackPtr ) : void
$phpcsFile PHP_CodeSniffer_File The file being scanned.
$stackPtr integer The position of the double quoted string.
return void