PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
extends PHP_CodeSniffer_Standards_AbstractScopeSniff
in package
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
Ensures method names are correct depending on whether they are public or private, and that functions are named correctly.
Tags
Table of Contents
- $magicFunctions : array<string|int, mixed>
- A list of all PHP magic functions.
- $magicMethods : array<string|int, mixed>
- A list of all PHP magic methods.
- $_listenOutside : bool
- True if this test should fire on tokens outside of the scope.
- $_scopeTokens : string
- The type of scope opener tokens that this test wishes to listen to.
- $_tokens : array<string|int, mixed>
- The token types that this test wishes to listen to within the scope.
- __construct() : mixed
- Constructs a PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
- process() : void
- Processes the tokens that this test is listening for.
- register() : array<string|int, int>
- The method that is called to register the tokens this test wishes to listen to.
- processTokenOutsideScope() : void
- Processes the tokens outside the scope.
- processTokenWithinScope() : void
- Processes the tokens within the scope.
Properties
$magicFunctions
A list of all PHP magic functions.
protected
array<string|int, mixed>
$magicFunctions
= array('autoload' => rue)
$magicMethods
A list of all PHP magic methods.
protected
array<string|int, mixed>
$magicMethods
= array('construct' => rue, 'destruct' => rue, 'call' => rue, 'callstatic' => rue, 'get' => rue, 'set' => rue, 'isset' => rue, 'unset' => rue, 'sleep' => rue, 'wakeup' => rue, 'tostring' => rue, 'set_state' => rue, 'clone' => rue, 'invoke' => rue, 'debuginfo' => rue)
$_listenOutside
True if this test should fire on tokens outside of the scope.
private
bool
$_listenOutside
= alse
$_scopeTokens
The type of scope opener tokens that this test wishes to listen to.
private
string
$_scopeTokens
= array()
$_tokens
The token types that this test wishes to listen to within the scope.
private
array<string|int, mixed>
$_tokens
= array()
Methods
__construct()
Constructs a PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
public
__construct() : mixed
Return values
mixed —process()
Processes the tokens that this test is listening for.
public
final process(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file where this token was found.
- $stackPtr : int
-
The position in the stack where this token was found.
Tags
Return values
void —register()
The method that is called to register the tokens this test wishes to listen to.
public
final register() : array<string|int, int>
DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register for the desired tokens and scope.
Tags
Return values
array<string|int, int> —processTokenOutsideScope()
Processes the tokens outside the scope.
protected
processTokenOutsideScope(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being processed.
- $stackPtr : int
-
The position where this token was found.
Return values
void —processTokenWithinScope()
Processes the tokens within the scope.
protected
processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, int $stackPtr, int $currScope) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file being processed.
- $stackPtr : int
-
The position where this token was found.
- $currScope : int
-
The position of the current scope.