apidoc
[ class tree: apidoc ] [ index: apidoc ] [ all elements ]

Class: AbstractVariableSniff

Source Location: /PHP_CodeSniffer-3.1.1/src/Sniffs/AbstractVariableSniff.php

Class Overview

AbstractScopeSniff
   |
   --AbstractVariableSniff

A class to find T_VARIABLE tokens.


Author(s):

Copyright:

  • 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)

Variables

Methods


Child classes:

PropertyDeclarationSniff
Verifies that properties are declared correctly.
MemberVarScopeSniff
Verifies that class members have scope modifiers.
MemberVarSpacingSniff
Verifies that class members are spaced correctly.
Checks the naming of member variables.
VariableCommentSniff
Parses and verifies the variable doc comment.

Inherited Variables

Inherited Methods

Class: AbstractScopeSniff

AbstractScopeSniff::__construct()
Constructs a new AbstractScopeTest.
AbstractScopeSniff::process()
Processes the tokens that this test is listening for.
AbstractScopeSniff::processTokenOutsideScope()
Processes a token that is found outside the scope that this test is listening to.
AbstractScopeSniff::processTokenWithinScope()
Processes a token that is found within the scope that this test is listening to.
AbstractScopeSniff::register()
The method that is called to register the tokens this test wishes to listen to.

Class Details

[line 22]
A class to find T_VARIABLE tokens.

This class can distinguish between normal T_VARIABLE tokens, and those tokens that represent class members. If a class member is encountered, then the processMemberVar method is called so the extending class can process it. If the token is found to be a normal T_VARIABLE token, then processVariable is called.



[ Top ]


Class Variables

$currentFile =  null

[line 44]

The current PHP_CodeSniffer file that we are processing.
  • Access: protected

Type:   \PHP_CodeSniffer\Files\File


[ Top ]



Method Detail

__construct (Constructor)   [line 50]

AbstractVariableSniff __construct( )

Constructs an AbstractVariableTest.
  • Access: public

Overrides AbstractScopeSniff::__construct() (Constructs a new AbstractScopeTest.)
[ Top ]

processMemberVar   [line 177]

void processMemberVar( File $phpcsFile, int $stackPtr)

Called to process class member vars.
  • Abstract:
  • Access: protected

Overridden in child classes as:

PropertyDeclarationSniff::processMemberVar()
Processes the function tokens within the class.
MemberVarScopeSniff::processMemberVar()
Processes the function tokens within the class.
MemberVarSpacingSniff::processMemberVar()
Processes the function tokens within the class.
ValidVariableNameSniff::processMemberVar()
Processes class member variables.
VariableCommentSniff::processMemberVar()
Called to process class member vars.

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where this token was found.
int   $stackPtr   —  The position where the token was found.

[ Top ]

processTokenOutsideScope   [line 149]

void processTokenOutsideScope( File $phpcsFile, int $stackPtr)

Processes the token outside the scope in the file.
  • Access: protected

Overrides AbstractScopeSniff::processTokenOutsideScope() (Processes a token that is found outside the scope that this test is listening to.)

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where this token was found.
int   $stackPtr   —  The position where the token was found.

[ Top ]

processTokenWithinScope   [line 76]

void processTokenWithinScope( File $phpcsFile, int $stackPtr, int $currScope)

Processes the token in the specified PHP_CodeSniffer_File.
  • Access: protected

Overrides AbstractScopeSniff::processTokenWithinScope() (Processes a token that is found within the scope that this test is listening to.)

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where this token was found.
int   $stackPtr   —  The position where the token was found.
int   $currScope   —  The current scope opener token.

[ Top ]

processVariable   [line 189]

void processVariable( File $phpcsFile, int $stackPtr)

Called to process normal member vars.
  • Abstract:
  • Access: protected

Overridden in child classes as:

PropertyDeclarationSniff::processVariable()
Processes normal variables.
MemberVarScopeSniff::processVariable()
Processes normal variables.
MemberVarSpacingSniff::processVariable()
Processes normal variables.
ValidVariableNameSniff::processVariable()
Processes normal variables.
VariableCommentSniff::processVariable()
Called to process a normal variable.

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where this token was found.
int   $stackPtr   —  The position where the token was found.

[ Top ]

processVariableInString   [line 205]

void processVariableInString( File $phpcsFile, int $stackPtr)

Called to process variables found in double quoted strings or heredocs.

Note that there may be more than one variable in the string, which will result only in one call for the string or one call per line for heredocs.

  • Abstract:
  • Access: protected

Overridden in child classes as:

PropertyDeclarationSniff::processVariableInString()
Processes variables in double quoted strings.
MemberVarScopeSniff::processVariableInString()
Processes variables in double quoted strings.
MemberVarSpacingSniff::processVariableInString()
Processes variables in double quoted strings.
ValidVariableNameSniff::processVariableInString()
Processes variables in double quoted strings.
VariableCommentSniff::processVariableInString()
Called to process variables found in double quoted strings.

Parameters:

\PHP_CodeSniffer\Files\File   $phpcsFile   —  The PHP_CodeSniffer file where this token was found.
int   $stackPtr   —  The position where the double quoted string was found.

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:27:14 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.