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


Classes:
PHP_CodeSniffer
AbstractPatternSniff
AbstractScopeSniff
AbstractVariableSniff
AjaxNullComparisonSniff
ArrayBracketSpacingSniff
ArrayDeclarationSniff
AssignThisSniff
Autoload
BacktickOperatorSniff
BlockCommentSniff
BrowserSpecificStylesSniff
ByteOrderMarkSniff
Cache
CallTimePassByReferenceSniff
CamelCapsFunctionNameSniff
CamelCapsMethodNameSniff
CastSpacingSniff
Cbf
CharacterBeforePHPOpeningTagSniff
Checkstyle
ClassCommentSniff
ClassDeclarationSniff
ClassDefinitionClosingBraceSpaceSniff
ClassDefinitionNameSpacingSniff
ClassDefinitionOpeningBraceSpaceSniff
ClassFileNameSniff
ClosingDeclarationCommentSniff
ClosingPHPTagSniff
ClosingTagSniff
ClosureLinterSniff
CodeAnalyzerSniff
ColonSpacingSniff
ColourDefinitionSniff
Comment
CommentedOutCodeSniff
Common
ComparisonOperatorUsageSniff
ConcatenationSpacingSniff
Config
ConstructorNameSniff
ControlSignatureSniff
ControlStructureSpacingSniff
CreateWidgetTypeCallbackSniff
CSS
CSSLintSniff
Csv
CyclomaticComplexitySniff
DebugCodeSniff
DeprecatedFunctionsSniff
Diff
DisallowAlternativePHPTagsSniff
DisallowBooleanStatementSniff
DisallowComparisonAssignmentSniff
DisallowInlineIfSniff
DisallowLongArraySyntaxSniff
DisallowMultipleAssignmentsSniff
DisallowMultipleStatementsSniff
DisallowMultipleStyleDefinitionsSniff
DisallowNewWidgetSniff
DisallowObEndFlushSniff
DisallowObjectStringIndexSniff
DisallowSelfActionsSniff
DisallowShortArraySyntaxSniff
DisallowShortOpenTagSniff
DisallowSizeFunctionsInLoopsSniff
DisallowSpaceIndentSniff
DisallowTabIndentSniff
DiscouragedFunctionsSniff
DocCommentAlignmentSniff
DocCommentSniff
DoubleQuoteUsageSniff
DummyFile
DuplicateClassDefinitionSniff
DuplicateClassNameSniff
DuplicatePropertySniff
DuplicateStyleDefinitionSniff
EchoedStringsSniff
ElseIfDeclarationSniff
Emacs
EmbeddedPhpSniff
EmptyCatchCommentSniff
EmptyClassDefinitionSniff
EmptyStatementSniff
EmptyStyleDefinitionSniff
EndFileNewlineSniff
EndFileNoNewlineSniff
EvalObjectFactorySniff
EvalSniff
ExactMatch
File
FileCommentSniff
FileExtensionSniff
FileList
Filter
FirebugConsoleSniff
Fixer
FixmeSniff
ForbiddenFunctionsSniff
ForbiddenStylesSniff
ForEachLoopDeclarationSniff
ForLoopDeclarationSniff
ForLoopShouldBeWhileLoopSniff
ForLoopWithTestFunctionCallSniff
Full
FunctionCallArgumentSpacingSniff
FunctionCallSignatureSniff
FunctionClosingBraceSniff
FunctionClosingBraceSpaceSniff
FunctionCommentSniff
FunctionCommentThrowTagSniff
FunctionDeclarationArgumentSpacingSniff
FunctionDeclarationSniff
FunctionDuplicateArgumentSniff
FunctionOpeningBraceSpaceSniff
FunctionSpacingSniff
Generator
GetRequestDataSniff
Gitblame
GitModified
GlobalFunctionSniff
GlobalKeywordSniff
HeredocSniff
Hgblame
HTML
IncludeOwnSystemSniff
IncludeSystemSniff
IncludingFileSniff
IncrementDecrementUsageSniff
IndentationSniff
Info
InlineCommentSniff
InlineControlStructureSniff
InlineHTMLSniff
InlineIfDeclarationSniff
InnerFunctionsSniff
JavaScriptLintSniff
JoinStringsSniff
JS
JSHintSniff
JSLintSniff
Json
JumbledIncrementerSniff
Junit
LanguageConstructSpacingSniff
LineEndingsSniff
LineLengthSniff
LocalFile
LogicalOperatorSpacingSniff
LongConditionClosingCommentSniff
LowercaseClassKeywordsSniff
LowerCaseConstantSniff
LowercaseDeclarationSniff
LowercasedFilenameSniff
LowercaseFunctionKeywordsSniff
LowerCaseKeywordSniff
LowercasePHPFunctionsSniff
LowercaseStyleDefinitionSniff
Markdown
MemberVarScopeSniff
MemberVarSpacingSniff
MethodDeclarationSniff
MethodScopeSniff
MissingColonSniff
MultiLineAssignmentSniff
MultiLineConditionSniff
MultiLineFunctionDeclarationSniff
MultipleStatementAlignmentSniff
NamedColoursSniff
NamespaceDeclarationSniff
NestingLevelSniff
NonExecutableCodeSniff
NoSilencedErrorsSniff
NoSpaceAfterCastSniff
Notifysend
ObjectInstantiationSniff
ObjectMemberCommaSniff
ObjectOperatorIndentSniff
ObjectOperatorSpacingSniff
OneClassPerFileSniff
OneInterfacePerFileSniff
OneTraitPerFileSniff
OpacitySniff
OpeningBraceSameLineSniff
OpeningFunctionBraceBsdAllmanSniff
OpeningFunctionBraceKernighanRitchieSniff
OperatorBracketSniff
OperatorSpacingSniff
PHP
PostStatementCommentSniff
PropertyDeclarationSniff
PropertyLabelSpacingSniff
Reporter
ReturnFunctionValueSniff
Ruleset
Runner
RuntimeException
SAPIUsageSniff
ScopeClosingBraceSniff
ScopeIndentSniff
ScopeKeywordSpacingSniff
SelfMemberReferenceSniff
SemicolonSpacingSniff
ShorthandSizeSniff
SideEffectsSniff
Source
SpaceAfterCastSniff
SpaceAfterNotSniff
Standards
StaticThisUsageSniff
SubversionPropertiesSniff
Summary
SuperfluousWhitespaceSniff
Svnblame
SwitchDeclarationSniff
SyntaxSniff
Text
Timing
TodoSniff
Tokenizer
TokenizerException
Tokens
UnconditionalIfStatementSniff
UnnecessaryFinalModifierSniff
UnnecessaryStringConcatSniff
UnusedFunctionParameterSniff
UnusedSystemSniff
UpperCaseConstantNameSniff
UpperCaseConstantSniff
UseDeclarationSniff
UselessOverridingMethodSniff
ValidClassNameSniff
ValidDefaultValueSniff
ValidFunctionNameSniff
ValidLogicalOperatorsSniff
ValidVariableNameSniff
VariableCommentSniff
VersionControl
Xml

Class: AbstractScopeSniff

Source Location: /PHP_CodeSniffer-3.0.0RC2/src/Sniffs/AbstractScopeSniff.php

Class Overview


Allows tests that extend this class to listen for tokens within a particular scope.


Author(s):

Copyright:

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

Methods


Child classes:

CamelCapsFunctionNameSniff
Ensures method and functions are named correctly.
ConstructorNameSniff
Bans PHP 4 style constructors.
MethodDeclarationSniff
Checks that the method declaration is correct.
SelfMemberReferenceSniff
Tests self member references.
MethodScopeSniff
Verifies that class methods have scope modifiers.
StaticThisUsageSniff
Checks for usage of $this in static methods, which will cause runtime errors.
FunctionCommentThrowTagSniff
Verifies that a @throws tag exists for each exception type a function throws.
ValidFunctionNameSniff
Ensures method and function names are correct.
IncludeSystemSniff
Ensures that systems, asset types and libs are included before they are used.
AbstractVariableSniff
A class to find T_VARIABLE tokens.

Inherited Variables

Inherited Methods


Class Details

[line 32]
Allows tests that extend this class to listen for tokens within a particular 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. }



[ Top ]


Method Detail

__construct (Constructor) [line 71]

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

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

Overridden in child classes as:

CamelCapsFunctionNameSniff::__construct()
Constructs a Generic_Sniffs_NamingConventions_CamelCapsFunctionNameSniff.
ConstructorNameSniff::__construct()
Constructs the test with the tokens it wishes to listen for.
MethodDeclarationSniff::__construct()
Constructs a Squiz_Sniffs_Scope_MethodScopeSniff.
SelfMemberReferenceSniff::__construct()
Constructs a Squiz_Sniffs_Classes_SelfMemberReferenceSniff.
MethodScopeSniff::__construct()
Constructs a Squiz_Sniffs_Scope_MethodScopeSniff.
StaticThisUsageSniff::__construct()
Constructs the test with the tokens it wishes to listen for.
FunctionCommentThrowTagSniff::__construct()
Constructs a Squiz_Sniffs_Commenting_FunctionCommentThrowTagSniff.
ValidFunctionNameSniff::__construct()
Constructs a PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff.
IncludeSystemSniff::__construct()
Constructs a Squiz_Sniffs_Scope_MethodScopeSniff.
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 processTokenOutsideScope method.

[ Top ]

process [line 127]

void process( File $phpcsFile, int $stackPtr)

Processes the tokens that this test is listening for.
  • See: processTokenWithinScope()
  • Access: public

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 172]

void processTokenOutsideScope( File $phpcsFile, int $stackPtr)

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

Overridden in child classes as:

CamelCapsFunctionNameSniff::processTokenOutsideScope()
Processes the tokens outside the scope.
ConstructorNameSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
MethodDeclarationSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
SelfMemberReferenceSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
MethodScopeSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
StaticThisUsageSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
FunctionCommentThrowTagSniff::processTokenOutsideScope()
Processes a token that is found within the scope that this test is listening to.
ValidFunctionNameSniff::processTokenOutsideScope()
Processes the tokens outside the scope.
IncludeSystemSniff::processTokenOutsideScope()
Processes a token within the scope that this test is listening to.
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 159]

void processTokenWithinScope( 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:

CamelCapsFunctionNameSniff::processTokenWithinScope()
Processes the tokens within the scope.
ConstructorNameSniff::processTokenWithinScope()
Processes this test when one of its tokens is encountered.
MethodDeclarationSniff::processTokenWithinScope()
Processes the function tokens within the class.
SelfMemberReferenceSniff::processTokenWithinScope()
Processes the function tokens within the class.
MethodScopeSniff::processTokenWithinScope()
Processes the function tokens within the class.
StaticThisUsageSniff::processTokenWithinScope()
Processes this test, when one of its tokens is encountered.
FunctionCommentThrowTagSniff::processTokenWithinScope()
Processes the function tokens within the class.
ValidFunctionNameSniff::processTokenWithinScope()
Processes the tokens within the scope.
IncludeSystemSniff::processTokenWithinScope()
Processes the function tokens within the class.
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 110]

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:49:27 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.

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