PHP_CodeSniffer
[ class tree: PHP_CodeSniffer ] [ index: PHP_CodeSniffer ] [ all elements ]
Packages:
PHP_CodeSniffer


Classes:
PEAR_Sniffs_Commenting_InlineCommentSniff
PEAR_Sniffs_Constants_ValidConstantNameSniff
PEAR_Sniffs_ControlStructures_ControlSignatureSniff
PEAR_Sniffs_Files_IncludingFileSniff
PEAR_Sniffs_Files_LineLengthSniff
PEAR_Sniffs_Methods_FunctionCallSignatureSniff
PEAR_Sniffs_Methods_MethodCallArgumentSpacingSniff
PEAR_Sniffs_Methods_OpeningMethodBraceSniff
PEAR_Sniffs_Methods_ValidDefaultValueSniff
PEAR_Sniffs_Misc_ShortOpenTagSniff
PEAR_Sniffs_NamingConventions_ValidClassNameSniff
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
PEAR_Sniffs_PHP_LowerCaseConstantSniff
PEAR_Sniffs_Statements_MultipleStatementSniff
PEAR_Sniffs_Whitespace_ScopeClosingBraceSniff
PEAR_Sniffs_Whitespace_ScopeIndentSniff
PHP_CodeSniffer
PHP_CodeSniffer_CommentParser_AbstractDocElement
PHP_CodeSniffer_CommentParser_AbstractParser
PHP_CodeSniffer_CommentParser_ClassCommentParser
PHP_CodeSniffer_CommentParser_CommentElement
PHP_CodeSniffer_CommentParser_FunctionCommentParser
PHP_CodeSniffer_CommentParser_MemberCommentParser
PHP_CodeSniffer_CommentParser_PairElement
PHP_CodeSniffer_CommentParser_ParameterElement
PHP_CodeSniffer_CommentParser_ParserException
PHP_CodeSniffer_CommentParser_SingleElement
PHP_CodeSniffer_Exception
PHP_CodeSniffer_File
PHP_CodeSniffer_Sniff_Exception
PHP_CodeSniffer_Standards_AbstractPatternSniff
PHP_CodeSniffer_Standards_AbstractScopeSniff
PHP_CodeSniffer_Standards_AbstractVariableSniff
PHP_CodeSniffer_Standards_IncorrectPatternException
PHP_CodeSniffer_Tokens
Files:
AbstractDocElement.php
AbstractParser.php
AbstractPatternSniff.php
AbstractScopeSniff.php
AbstractVariableSniff.php
ClassCommentParser.php
CodeSniffer.php
CommentElement.php
ControlSignatureSniff.php
DocElement.php
Exception.php
File.php
FunctionCallSignatureSniff.php
FunctionCommentParser.php
IncludingFileSniff.php
IncorrectPatternException.php
InlineCommentSniff.php
LineLengthSniff.php
LowerCaseConstantSniff.php
MemberCommentParser.php
MethodCallArgumentSpacingSniff.php
MultipleStatementSniff.php
OpeningMethodBraceSniff.php
PairElement.php
ParameterElement.php
ParserException.php
ScopeClosingBraceSniff.php
ScopeIndentSniff.php
ShortOpenTagSniff.php
SingleElement.php
Sniff.php
SniffException.php
Tokens.php
ValidClassNameSniff.php
ValidConstantNameSniff.php
ValidDefaultValueSniff.php
ValidFunctionNameSniff.php

Class: PHP_CodeSniffer_Standards_AbstractScopeSniff

Source Location: /PHP_CodeSniffer-0.1.0/CodeSniffer/Standards/AbstractScopeSniff.php

Class Overview


An AbstractScopeTest allows for tests that extend from this class to listen for tokens within a particluar scope.


Author(s):

  • Squiz Pty Ltd

Variables

Methods


Child classes:

PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
PHP_CodeSniffer_Standards_AbstractVariableSniff
A class to find T_VARIABLE tokens.

Inherited Variables

Inherited Methods


Class Details

[line 60]
An AbstractScopeTest allows for tests that extend from this class to listen for tokens within a particluar scope.

Below is a test that listens to methods that exist only within classes:

  1. class ClassScopeTest extends PHP_CodeSniffer_Standards_AbstractScopeSniff
  2. {
  3. public function __construct()
  4. {
  5. parent::__construct(array(T_CLASS), array(T_FUNCTION));
  6. }
  7. protected function processTokenWithinScope(PHP_CodeSniffer_File $phpcsFile, $)
  8. {
  9. $className = $phpcsFile->getDeclarationName($currScope);
  10. echo 'encountered a method within class '.$className;
  11. }
  12. }

  • Author: Squiz Pty Ltd
  • Abstract:


[ Top ]


Class Variables

$currScope = null

[line 82]

The position in the tokens array that opened the current scope.
  • Access: protected

Type: array()


[ Top ]



Method Detail

__construct (Constructor) [line 106]

PHP_CodeSniffer_Standards_AbstractScopeSniff __construct( array $scopeTokens, array $tokens, [boolean $listenOutside = false])

Constructs a new AbstractScopeTest.
  • See: PHP_CodeSniffer.getValidScopeTokeners()
  • Throws: PHP_CodeSniffer_Test_Exception If the specified tokens array is empty.
  • Access: public

Overridden in child classes as:

PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff::__construct()
Constructs a PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
PHP_CodeSniffer_Standards_AbstractVariableSniff::__construct()
Constructs an AbstractVariableTest.

Parameters:

array $scopeTokens — The type of scope the test wishes to listen to.
array $tokens — The tokens that the test wishes to listen to within the scope.
boolean $listenOutside — If true this test will also alert the extending class when a token is found outside the scope, by calling the processTokenOutideScope.

[ Top ]

process [line 162]

void process( PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

Processes the tokens that this test is listening for.

Parameters:

PHP_CodeSniffer_File $phpcsFile — The file where this token was found.
int $stackPtr — The position in the stack where this token was found.

[ Top ]

processTokenOutsideScope [line 215]

void processTokenOutsideScope( PHP_CodeSniffer_File $phpcsFile, int $stackPtr)

Processes a token that is found within the scope that this test is listening to.
  • Access: protected

Overridden in child classes as:

PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff::processTokenOutsideScope()
Processes the tokens outside the scope.
PHP_CodeSniffer_Standards_AbstractVariableSniff::processTokenOutsideScope()
Processes the token outside the scope in the file.

Parameters:

PHP_CodeSniffer_File $phpcsFile — The file where this token was found.
int $stackPtr — The position in the stack where this token was found.

[ Top ]

processTokenWithinScope [line 202]

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

Processes a token that is found within the scope that this test is listening to.
  • Abstract:
  • Access: protected

Overridden in child classes as:

PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff::processTokenWithinScope()
Processes the tokens within the scope.
PHP_CodeSniffer_Standards_AbstractVariableSniff::processTokenWithinScope()
Processes the token in the specified PHP_CodeSniffer_File.

Parameters:

PHP_CodeSniffer_File $phpcsFile — The file where this token was found.
int $stackPtr — The position in the stack where this token was found.
int $currScope — The position in the tokens array that opened the scope that this test is listening for.

[ Top ]

register [line 145]

array(int) register( )

The method that is called to register the tokens this test wishes to listen to.

DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register for the desired tokens and scope.

  • See: __constructor()
  • Access: public

[ Top ]


Documentation generated on 2019年3月11日 14:44:37 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.

AltStyle によって変換されたページ (->オリジナル) /