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: PHP

Source Location: /PHP_CodeSniffer-3.0.0RC2/src/Tokenizers/PHP.php

Class Overview

Tokenizer
 |
 --PHP

Tokenizes PHP code.


Author(s):

Copyright:

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

Variables

Methods


Child classes:

CSS
Tokenizes CSS code.

Inherited Variables

Class: Tokenizer

Tokenizer::$config
Tokenizer::$eolChar
Tokenizer::$ignoredLines
Tokenizer::$tokens

Inherited Methods

Class: Tokenizer

Tokenizer::__construct()
Initialise and run the tokenizer.
Tokenizer::getTokens()
Gets the array of tokens.
Tokenizer::isMinifiedContent()
Checks the content to see if it looks minified.
Tokenizer::processAdditional()
Performs additional processing after main tokenizing.
Tokenizer::replaceTabsInToken()
Replaces tabs in original token content with spaces.
Tokenizer::tokenize()
Creates an array of tokens when given some content.

Class Details

[line 14]
Tokenizes PHP code.


[ Top ]


Class Variables

$endScopeTokens = array(
T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET,
T_ENDIF => T_ENDIF,
T_ENDFOR => T_ENDFOR,
T_ENDFOREACH => T_ENDFOREACH,
T_ENDWHILE => T_ENDWHILE,
T_ENDSWITCH => T_ENDSWITCH,
T_BREAK => T_BREAK,
T_END_HEREDOC => T_END_HEREDOC,
)

[line 267]

A list of tokens that end the scope.

This array is just a unique collection of the end tokens from the _scopeOpeners array. The data is duplicated here to save time during parsing of the file.

  • Access: public

Type: array


[ Top ]

$knownLengths = array(
T_ABSTRACT => 8,
T_AND_EQUAL => 2,
T_ARRAY => 5,
T_AS => 2,
T_BOOLEAN_AND => 2,
T_BOOLEAN_OR => 2,
T_BREAK => 5,
T_CALLABLE => 8,
T_CASE => 4,
T_CATCH => 5,
T_CLASS => 5,
T_CLASS_C => 9,
T_CLONE => 5,
T_CONCAT_EQUAL => 2,
T_CONST => 5,
T_CONTINUE => 8,
T_CURLY_OPEN => 2,
T_DEC => 2,
T_DECLARE => 7,
T_DEFAULT => 7,
T_DIR => 7,
T_DIV_EQUAL => 2,
T_DO => 2,
T_DOLLAR_OPEN_CURLY_BRACES => 2,
T_DOUBLE_ARROW => 2,
T_DOUBLE_COLON => 2,
T_ECHO => 4,
T_ELSE => 4,
T_ELSEIF => 6,
T_EMPTY => 5,
T_ENDDECLARE => 10,
T_ENDFOR => 6,
T_ENDFOREACH => 10,
T_ENDIF => 5,
T_ENDSWITCH => 9,
T_ENDWHILE => 8,
T_EVAL => 4,
T_EXTENDS => 7,
T_FILE => 8,
T_FINAL => 5,
T_FINALLY => 7,
T_FOR => 3,
T_FOREACH => 7,
T_FUNCTION => 8,
T_FUNC_C => 12,
T_GLOBAL => 6,
T_GOTO => 4,
T_HALT_COMPILER => 15,
T_IF => 2,
T_IMPLEMENTS => 10,
T_INC => 2,
T_INCLUDE => 7,
T_INCLUDE_ONCE => 12,
T_INSTANCEOF => 10,
T_INSTEADOF => 9,
T_INTERFACE => 9,
T_ISSET => 5,
T_IS_EQUAL => 2,
T_IS_GREATER_OR_EQUAL => 2,
T_IS_IDENTICAL => 3,
T_IS_NOT_EQUAL => 2,
T_IS_NOT_IDENTICAL => 3,
T_IS_SMALLER_OR_EQUAL => 2,
T_LINE => 8,
T_LIST => 4,
T_LOGICAL_AND => 3,
T_LOGICAL_OR => 2,
T_LOGICAL_XOR => 3,
T_METHOD_C => 10,
T_MINUS_EQUAL => 2,
T_POW_EQUAL => 3,
T_MOD_EQUAL => 2,
T_MUL_EQUAL => 2,
T_NAMESPACE => 9,
T_NS_C => 13,
T_NS_SEPARATOR => 1,
T_NEW => 3,
T_OBJECT_OPERATOR => 2,
T_OPEN_TAG_WITH_ECHO => 3,
T_OR_EQUAL => 2,
T_PLUS_EQUAL => 2,
T_PRINT => 5,
T_PRIVATE => 7,
T_PUBLIC => 6,
T_PROTECTED => 9,
T_REQUIRE => 7,
T_REQUIRE_ONCE => 12,
T_RETURN => 6,
T_STATIC => 6,
T_SWITCH => 6,
T_THROW => 5,
T_TRAIT => 5,
T_TRAIT_C => 9,
T_TRY => 3,
T_UNSET => 5,
T_USE => 3,
T_VAR => 3,
T_WHILE => 5,
T_XOR_EQUAL => 2,
T_YIELD => 5,
T_OPEN_CURLY_BRACKET => 1,
T_CLOSE_CURLY_BRACKET => 1,
T_OPEN_SQUARE_BRACKET => 1,
T_CLOSE_SQUARE_BRACKET => 1,
T_OPEN_PARENTHESIS => 1,
T_CLOSE_PARENTHESIS => 1,
T_COLON => 1,
T_STRING_CONCAT => 1,
T_INLINE_THEN => 1,
T_INLINE_ELSE => 1,
T_NULL => 4,
T_FALSE => 5,
T_TRUE => 4,
T_SEMICOLON => 1,
T_EQUAL => 1,
T_MULTIPLY => 1,
T_DIVIDE => 1,
T_PLUS => 1,
T_MINUS => 1,
T_MODULUS => 1,
T_POW => 2,
T_SPACESHIP => 3,
T_COALESCE => 2,
T_BITWISE_AND => 1,
T_BITWISE_OR => 1,
T_BITWISE_XOR => 1,
T_SL => 2,
T_SR => 2,
T_SL_EQUAL => 3,
T_SR_EQUAL => 3,
T_ARRAY_HINT => 5,
T_GREATER_THAN => 1,
T_LESS_THAN => 1,
T_BOOLEAN_NOT => 1,
T_SELF => 4,
T_PARENT => 6,
T_COMMA => 1,
T_THIS => 4,
T_CLOSURE => 8,
T_BACKTICK => 1,
T_OPEN_SHORT_ARRAY => 1,
T_CLOSE_SHORT_ARRAY => 1,
)

[line 283]

Known lengths of tokens.
  • Var: int>
  • Access: public

Type: array
Overrides: Array


[ Top ]

$scopeOpeners = array(
T_IF => array(
'start' => array(
T_OPEN_CURLY_BRACKET => T_OPEN_CURLY_BRACKET,
T_COLON => T_COLON,
),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDIF=>T_ENDIF,T_ELSE=>T_ELSE,T_ELSEIF=>T_ELSEIF,),'strict'=>false,'shared'=>false,'with'=>array(T_ELSE=>T_ELSE,T_ELSEIF=>T_ELSEIF,),),T_TRY=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CATCH=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_FINALLY=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_ELSE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDIF=>T_ENDIF,),'strict'=>false,'shared'=>false,'with'=>array(T_IF=>T_IF,T_ELSEIF=>T_ELSEIF,),),T_ELSEIF=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDIF=>T_ENDIF,T_ELSE=>T_ELSE,T_ELSEIF=>T_ELSEIF,),'strict'=>false,'shared'=>false,'with'=>array(T_IF=>T_IF,T_ELSE=>T_ELSE,),),T_FOR=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDFOR=>T_ENDFOR,),'strict'=>false,'shared'=>false,'with'=>array(),),T_FOREACH=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDFOREACH=>T_ENDFOREACH,),'strict'=>false,'shared'=>false,'with'=>array(),),T_INTERFACE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_FUNCTION=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CLASS=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_TRAIT=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_USE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_DECLARE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_NAMESPACE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_WHILE=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDWHILE=>T_ENDWHILE,),'strict'=>false,'shared'=>false,'with'=>array(),),T_DO=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_SWITCH=>array('start'=>array(T_OPEN_CURLY_BRACKET=>T_OPEN_CURLY_BRACKET,T_COLON=>T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET,T_ENDSWITCH=>T_ENDSWITCH,),'strict'=>true,'shared'=>false,'with'=>array(),),T_CASE=>array('start'=>array(T_COLON=>T_COLON,T_SEMICOLON=>T_SEMICOLON,),'end'=>array(T_BREAK=>T_BREAK,T_RETURN=>T_RETURN,T_CONTINUE=>T_CONTINUE,T_THROW=>T_THROW,T_EXIT=>T_EXIT,),'strict'=>true,'shared'=>true,'with'=>array(T_DEFAULT=>T_DEFAULT,T_CASE=>T_CASE,T_SWITCH=>T_SWITCH,),),T_DEFAULT=>array('start'=>array(T_COLON=>T_COLON,T_SEMICOLON=>T_SEMICOLON,),'end'=>array(T_BREAK=>T_BREAK,T_RETURN=>T_RETURN,T_CONTINUE=>T_CONTINUE,T_THROW=>T_THROW,T_EXIT=>T_EXIT,),'strict'=>true,'shared'=>true,'with'=>array(T_CASE=>T_CASE,T_SWITCH=>T_SWITCH,),),T_START_HEREDOC=>array('start'=>array(T_START_HEREDOC=>T_START_HEREDOC),'end'=>array(T_END_HEREDOC=>T_END_HEREDOC),'strict'=>true,'shared'=>false,'with'=>array(),),)

[line 28]

A list of tokens that are allowed to open a scope.

This array also contains information about what kind of token the scope opener uses to open and close the scope, if the token strictly requires an opener, if the token can share a scope closer, and who it can be shared with. An example of a token that shares a scope closer is a CASE scope.

  • Access: public

Type: array


[ Top ]



Method Detail

processAdditional [line 1143]

void processAdditional( )

Performs additional processing after main tokenizing.

This additional processing checks for CASE statements that are using curly braces for scope openers and closers. It also turns some T_FUNCTION tokens into T_CLOSURE when they are not standard function definitions. It also detects short array syntax and converts those square brackets into new tokens. It also corrects some usage of the static and class keywords. It also assigns tokens to function return types.

  • Access: protected

Overridden in child classes as:

CSS::processAdditional()
Performs additional processing after main tokenizing.

Overrides Tokenizer::processAdditional() (Performs additional processing after main tokenizing.)
[ Top ]

resolveSimpleToken [line 1618]

array resolveSimpleToken( string $token)

Converts simple tokens into a format that conforms to complex tokens produced by token_get_all().

Simple tokens are tokens that are not in array form when produced from token_get_all().

  • Return: The new token in array format.
  • Access: public

Parameters:

string $token — The simple token to convert.

[ Top ]

standardiseToken [line 1537]

array standardiseToken( string|array $token)

Takes a token produced from
  1. token_get_all()
and produces a more uniform token.
  • Return: The new token.
  • Access: public

Parameters:

string|array $token — The token to convert.

[ Top ]

tokenize [line 448]

array tokenize( string $string)

Creates an array of tokens when given some PHP code.

Starts by using token_get_all() but does a lot of extra processing to insert information about the context of the token.

  • Access: protected

Overridden in child classes as:

CSS::tokenize()
Creates an array of tokens when given some CSS code.

Overrides Tokenizer::tokenize() (Creates an array of tokens when given some content.)

Parameters:

string $string — The string to tokenize.

[ Top ]


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

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