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


Classes:
Generic_Sniffs_Files_LineEndingsSniff
Generic_Sniffs_Files_LineLengthSniff
Generic_Sniffs_Formatting_MultipleStatementAlignmentSniff
Generic_Sniffs_Formatting_NoSpaceAfterCastSniff
Generic_Sniffs_Formatting_SpaceAfterCastSniff
Generic_Sniffs_Functions_OpeningFunctionBraceBsdAllmanSniff
Generic_Sniffs_Functions_OpeningFunctionBraceKernighanRitchieSniff
Generic_Sniffs_Metrics_CyclomaticComplexitySniff
Generic_Sniffs_Metrics_NestingLevelSniff
Generic_Sniffs_NamingConventions_UpperCaseConstantNameSniff
Generic_Sniffs_PHP_DisallowShortOpenTagSniff
Generic_Sniffs_PHP_ForbiddenFunctionsSniff
Generic_Sniffs_PHP_LowerCaseConstantSniff
Generic_Sniffs_PHP_UpperCaseConstantSniff
Generic_Sniffs_WhiteSpace_DisallowTabIndentSniff
Generic_Sniffs_WhiteSpace_ScopeIndentSniff
PEAR_Sniffs_Classes_ClassDeclarationSniff
PEAR_Sniffs_Commenting_ClassCommentSniff
PEAR_Sniffs_Commenting_FileCommentSniff
PEAR_Sniffs_Commenting_FunctionCommentSniff
PEAR_Sniffs_Commenting_InlineCommentSniff
PEAR_Sniffs_ControlStructures_ControlSignatureSniff
PEAR_Sniffs_Files_IncludingFileSniff
PEAR_Sniffs_Files_LineEndingsSniff
PEAR_Sniffs_Files_LineLengthSniff
PEAR_Sniffs_Functions_FunctionCallArgumentSpacingSniff
PEAR_Sniffs_Functions_FunctionCallSignatureSniff
PEAR_Sniffs_Functions_ValidDefaultValueSniff
PEAR_Sniffs_NamingConventions_ValidClassNameSniff
PEAR_Sniffs_NamingConventions_ValidFunctionNameSniff
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_DocGenerators_Generator
PHP_CodeSniffer_DocGenerators_HTML
PHP_CodeSniffer_DocGenerators_Text
PHP_CodeSniffer_Exception
PHP_CodeSniffer_File
PHP_CodeSniffer_Standards_AbstractPatternSniff
PHP_CodeSniffer_Standards_AbstractScopeSniff
PHP_CodeSniffer_Standards_AbstractVariableSniff
PHP_CodeSniffer_Standards_CodingStandard
PHP_CodeSniffer_Standards_Generic_GenericCodingStandard
PHP_CodeSniffer_Standards_IncorrectPatternException
PHP_CodeSniffer_Standards_PEAR_PEARCodingStandard
PHP_CodeSniffer_Standards_PHPCS_PHPCSCodingStandard
PHP_CodeSniffer_Standards_Squiz_SquizCodingStandard
PHP_CodeSniffer_Standards_Zend_ZendCodingStandard
PHP_CodeSniffer_Tokens
Squiz_Sniffs_Arrays_ArrayBracketSpacingSniff
Squiz_Sniffs_Arrays_ArrayDeclarationSniff
Squiz_Sniffs_Classes_ClassDeclarationSniff
Squiz_Sniffs_Classes_ClassFileNameSniff
Squiz_Sniffs_Classes_LowercaseClassKeywordsSniff
Squiz_Sniffs_Classes_SelfMemberReferenceSniff
Squiz_Sniffs_Classes_ValidClassNameSniff
Squiz_Sniffs_Commenting_BlockCommentSniff
Squiz_Sniffs_Commenting_ClassCommentSniff
Squiz_Sniffs_Commenting_ClosingDeclarationCommentSniff
Squiz_Sniffs_Commenting_DocCommentAlignmentSniff
Squiz_Sniffs_Commenting_EmptyCatchCommentSniff
Squiz_Sniffs_Commenting_FileCommentSniff
Squiz_Sniffs_Commenting_FunctionCommentSniff
Squiz_Sniffs_Commenting_FunctionCommentThrowTagSniff
Squiz_Sniffs_Commenting_InlineCommentSniff
Squiz_Sniffs_Commenting_LongConditionClosingCommentSniff
Squiz_Sniffs_Commenting_PostStatementCommentSniff
Squiz_Sniffs_Commenting_VariableCommentSniff
Squiz_Sniffs_ControlStructures_ControlSignatureSniff
Squiz_Sniffs_ControlStructures_ElseIfDeclarationSniff
Squiz_Sniffs_ControlStructures_ForEachLoopDeclarationSniff
Squiz_Sniffs_ControlStructures_ForLoopDeclarationSniff
Squiz_Sniffs_ControlStructures_InlineControlStructureSniff
Squiz_Sniffs_ControlStructures_InlineIfDeclarationSniff
Squiz_Sniffs_ControlStructures_LowercaseDeclarationSniff
Squiz_Sniffs_ControlStructures_SwitchDeclarationSniff
Squiz_Sniffs_Files_FileExtensionSniff
Squiz_Sniffs_Files_LineEndingsSniff
Squiz_Sniffs_Files_LineLengthSniff
Squiz_Sniffs_Formatting_MultipleStatementAlignmentSniff
Squiz_Sniffs_Formatting_OperatorBracketSniff
Squiz_Sniffs_Formatting_OutputBufferingIndentSniff
Squiz_Sniffs_Functions_FunctionDeclarationArgumentSpacingSniff
Squiz_Sniffs_Functions_FunctionDeclarationSniff
Squiz_Sniffs_Functions_FunctionDuplicateArgumentSniff
Squiz_Sniffs_Functions_GlobalFunctionSniff
Squiz_Sniffs_Functions_LowercaseFunctionKeywordsSniff
Squiz_Sniffs_NamingConventions_ValidFunctionNameSniff
Squiz_Sniffs_NamingConventions_ValidInterfaceNameSniff
Squiz_Sniffs_NamingConventions_ValidVariableNameSniff
Squiz_Sniffs_Objects_ObjectInstantiationSniff
Squiz_Sniffs_Operators_ComparisonOperatorUsageSniff
Squiz_Sniffs_Operators_IncrementDecrementUsageSniff
Squiz_Sniffs_Operators_ValidLogicalOperatorsSniff
Squiz_Sniffs_PHP_CommentedOutCodeSniff
Squiz_Sniffs_PHP_DisallowMultipleAssignmentsSniff
Squiz_Sniffs_PHP_DisallowObEndFlushSniff
Squiz_Sniffs_PHP_EmbeddedPhpSniff
Squiz_Sniffs_PHP_EvalSniff
Squiz_Sniffs_PHP_ForbiddenFunctionsSniff
Squiz_Sniffs_PHP_GlobalKeywordSniff
Squiz_Sniffs_PHP_HeredocSniff
Squiz_Sniffs_PHP_InnerFunctionsSniff
Squiz_Sniffs_PHP_LowercasePHPFunctionsSniff
Squiz_Sniffs_PHP_NonExecutableCodeSniff
Squiz_Sniffs_Scope_MemberVarScopeSniff
Squiz_Sniffs_Scope_MethodScopeSniff
Squiz_Sniffs_Scope_StaticThisUsageSniff
Squiz_Sniffs_Strings_ConcatenationSpacingSniff
Squiz_Sniffs_Strings_DoubleQuoteUsageSniff
Squiz_Sniffs_Strings_EchoedStringsSniff
Squiz_Sniffs_WhiteSpace_CastSpacingSniff
Squiz_Sniffs_WhiteSpace_ControlStructureSpacingSniff
Squiz_Sniffs_WhiteSpace_FunctionClosingBraceSpaceSniff
Squiz_Sniffs_WhiteSpace_FunctionOpeningBraceSpaceSniff
Squiz_Sniffs_WhiteSpace_FunctionSpacingSniff
Squiz_Sniffs_WhiteSpace_MemberVarSpacingSniff
Squiz_Sniffs_WhiteSpace_ObjectOperatorSpacingSniff
Squiz_Sniffs_WhiteSpace_OperatorSpacingSniff
Squiz_Sniffs_WhiteSpace_ScopeClosingBraceSniff
Squiz_Sniffs_WhiteSpace_ScopeIndentSniff
Squiz_Sniffs_WhiteSpace_ScopeKeywordSpacingSniff
Squiz_Sniffs_WhiteSpace_SemicolonSpacingSniff
Squiz_Sniffs_WhiteSpace_SuperfluousWhitespaceSniff
Zend_Sniffs_Debug_CodeAnalyzerSniff
Zend_Sniffs_Files_ClosingTagSniff
Zend_Sniffs_Files_LineLengthSniff
Zend_Sniffs_NamingConventions_ValidVariableNameSniff
Files:
AbstractDocElement.php
AbstractParser.php
AbstractPatternSniff.php
AbstractScopeSniff.php
AbstractVariableSniff.php
ArrayBracketSpacingSniff.php
ArrayDeclarationSniff.php
BlockCommentSniff.php
CastSpacingSniff.php
ClassCommentParser.php
ClassCommentSniff.php
ClassCommentSniff.php
ClassDeclarationSniff.php
ClassDeclarationSniff.php
ClassFileNameSniff.php
ClosingDeclarationCommentSniff.php
ClosingTagSniff.php
CodeAnalyzerSniff.php
CodeSniffer.php
CodingStandard.php
CommentedOutCodeSniff.php
CommentElement.php
ComparisonOperatorUsageSniff.php
ConcatenationSpacingSniff.php
ControlSignatureSniff.php
ControlSignatureSniff.php
ControlStructureSpacingSniff.php
CyclomaticComplexitySniff.php
DisallowMultipleAssignmentsSniff.php
DisallowObEndFlushSniff.php
DisallowShortOpenTagSniff.php
DisallowTabIndentSniff.php
DocCommentAlignmentSniff.php
DocElement.php
DoubleQuoteUsageSniff.php
EchoedStringsSniff.php
ElseIfDeclarationSniff.php
EmbeddedPhpSniff.php
EmptyCatchCommentSniff.php
EvalSniff.php
Exception.php
File.php
FileCommentSniff.php
FileCommentSniff.php
FileExtensionSniff.php
ForbiddenFunctionsSniff.php
ForbiddenFunctionsSniff.php
ForEachLoopDeclarationSniff.php
ForLoopDeclarationSniff.php
FunctionCallArgumentSpacingSniff.php
FunctionCallSignatureSniff.php
FunctionClosingBraceSpaceSniff.php
FunctionCommentParser.php
FunctionCommentSniff.php
FunctionCommentSniff.php
FunctionCommentThrowTagSniff.php
FunctionDeclarationArgumentSpacingSniff.php
FunctionDeclarationSniff.php
FunctionDuplicateArgumentSniff.php
FunctionOpeningBraceSpaceSniff.php
FunctionSpacingSniff.php
Generator.php
GenericCodingStandard.php
GlobalFunctionSniff.php
GlobalKeywordSniff.php
HeredocSniff.php
HTML.php
IncludingFileSniff.php
IncorrectPatternException.php
IncrementDecrementUsageSniff.php
InlineCommentSniff.php
InlineCommentSniff.php
InlineControlStructureSniff.php
InlineIfDeclarationSniff.php
InnerFunctionsSniff.php
LineEndingsSniff.php
LineEndingsSniff.php
LineEndingsSniff.php
LineLengthSniff.php
LineLengthSniff.php
LineLengthSniff.php
LineLengthSniff.php
LongConditionClosingCommentSniff.php
LowercaseClassKeywordsSniff.php
LowerCaseConstantSniff.php
LowercaseDeclarationSniff.php
LowercaseFunctionKeywordsSniff.php
LowercasePHPFunctionsSniff.php
MemberCommentParser.php
MemberVarScopeSniff.php
MemberVarSpacingSniff.php
MethodScopeSniff.php
MultipleStatementAlignmentSniff.php
MultipleStatementAlignmentSniff.php
NestingLevelSniff.php
NonExecutableCodeSniff.php
NoSpaceAfterCastSniff.php
ObjectInstantiationSniff.php
ObjectOperatorSpacingSniff.php
OpeningFunctionBraceBsdAllmanSniff.php
OpeningFunctionBraceKernighanRitchieSniff.php
OperatorBracketSniff.php
OperatorSpacingSniff.php
OutputBufferingIndentSniff.php
PairElement.php
ParameterElement.php
ParserException.php
PEARCodingStandard.php
PHPCSCodingStandard.php
PostStatementCommentSniff.php
ScopeClosingBraceSniff.php
ScopeClosingBraceSniff.php
ScopeIndentSniff.php
ScopeIndentSniff.php
ScopeIndentSniff.php
ScopeKeywordSpacingSniff.php
SelfMemberReferenceSniff.php
SemicolonSpacingSniff.php
SingleElement.php
Sniff.php
SpaceAfterCastSniff.php
SquizCodingStandard.php
StaticThisUsageSniff.php
SuperfluousWhitespaceSniff.php
SwitchDeclarationSniff.php
Text.php
Tokens.php
UpperCaseConstantNameSniff.php
UpperCaseConstantSniff.php
ValidClassNameSniff.php
ValidClassNameSniff.php
ValidDefaultValueSniff.php
ValidFunctionNameSniff.php
ValidFunctionNameSniff.php
ValidInterfaceNameSniff.php
ValidLogicalOperatorsSniff.php
ValidVariableNameSniff.php
ValidVariableNameSniff.php
VariableCommentSniff.php
ZendCodingStandard.php

Class: PHP_CodeSniffer_File

Source Location: /PHP_CodeSniffer-1.0.0RC1/CodeSniffer/File.php


Inherited Variables

Inherited Methods


Class Details

[line 118]
A PHP_CodeSniffer_File object represents a PHP source file and the tokens associated with it.

It provides a means for traversing the token stack, along with other token related operations. If a PHP_CodeSniffer_Sniff finds and error or warning within a PHP_CodeSniffer_File, you can raise an error using the addError() or addWarning() methods.

Token Information

Each token within the stack contains information about itself:

  1. array(
  2. 'code' => 301, // the token type code (see token_get_all())
  3. 'content' => 'if', // the token content
  4. 'type' => 'T_IF', // the token name
  5. 'line' => 56, // the line number when the token is located
  6. 'column' => 12, // the column in the line where this token
  7. // starts (starts from 1)
  8. 'level' => 2 // the depth a token is within the scopes open
  9. 'conditions' => array( // a list of scope condition token
  10. // positions => codes that
  11. 2 => 50, // openened the scopes that this token exists
  12. 9 => 353, // in (see conditional tokens section below)
  13. ),
  14. );

Conditional Tokens

In addition to the standard token fields, conditions contain information to determine where their scope begins and ends:

  1. array(
  2. 'scope_condition' => 38, // the token position of the condition
  3. 'scope_opener' => 41, // the token position that started the scope
  4. 'scope_closer' => 70, // the token position that ended the scope
  5. );

The condition, the scope opener and the scope closer each contain this information.

Parenthesis Tokens

Each parenthesis token (T_OPEN_PARENTHESIS and T_CLOSE_PARENTHESIS) has a reference to their opening and closing parenthesis, one being itself, the other being its oposite.

  1. array(
  2. 'parenthesis_opener' => 34,
  3. 'parenthesis_closer' => 40,
  4. );

Some tokens can "own" a set of parethesis. For example a T_FUNCTION token has parenthesis around its argument list. These tokens also have the parenthesis_opener and and parenthesis_closer indicies. Not all parethesis have owners, for example parenthesis used for arithmetic operations and function calls. The parenthesis tokens that have an owner have the following auxilery array indicies.

  1. array(
  2. 'parenthesis_opener' => 34,
  3. 'parenthesis_closer' => 40,
  4. 'parenthesis_owner' => 33,
  5. );

Each token within a set of parenthesis also has an array indicy 'nested_parenthesis' which is an array of the left parenthesis => right parenthesis token positions.

  1. 'nested_parentheisis' => array(
  2. 12 => 15
  3. 11 => 14
  4. );

Extended Tokens

PHP_CodeSniffer extends and augments some of the tokens created by token_get_all(). A full list of these tokens can be seen in the Tokens.php file.



[ Top ]


Class Variables

$eolChar = ''

[line 133]

The EOL character this file uses.
  • Access: public

Type: string


[ Top ]



Method Detail

__construct (Constructor) [line 322]

PHP_CodeSniffer_File __construct( string $file, array $listeners)

Constructs a PHP_CodeSniffer_File.
  • Throws: PHP_CodeSniffer_Exception If the register() method does not return an array.
  • Access: public

Parameters:

string $file — The absolute path to the file to process.
array(string) $listeners — The initial listeners listening to processing of this file.

[ Top ]

addError [line 533]

void addError( string $error, int $stackPtr)

Adds an error to the error stack.
  • Throws: PHP_CodeSniffer_Exception If $stackPtr is null.
  • Access: public

Parameters:

string $error — The error message.
int $stackPtr — The stack position where the error occured.

[ Top ]

addTokenListener [line 355]

void addTokenListener( PHP_CodeSniffer_Sniff $listener, array $tokens)

Adds a listener to the token stack that listens to the specific tokens.

When PHP_CodeSniffer encounters on the the tokens specified in $tokens, it invokes the process method of the sniff.

  • Access: public

Parameters:

PHP_CodeSniffer_Sniff $listener — The listener to add to the listener stack.
array(int) $tokens — The token types the listener wishes to listen to.

[ Top ]

addWarning [line 565]

void addWarning( string $warning, int $stackPtr)

Adds an warning to the warning stack.
  • Throws: PHP_CodeSniffer_Exception If $stackPtr is null.
  • Access: public

Parameters:

string $warning — The error message.
int $stackPtr — The stack position where the error occured.

[ Top ]

detectLineEndings [line 499]

string detectLineEndings( string $file)

Opens a file and detects the EOL character being used.
  • Throws: PHP_CodeSniffer_Exception If $file could not be opened.
  • Access: public

Parameters:

string $file — The full path to the file.

[ Top ]

findFirstOnLine [line 1996]

int findFirstOnLine( int|array $types, int $start, [bool $exclude = false], [string $value = null])

Returns the position of the first token on a line, matching given type.

Returns false if no token can be found.

  • Return: | bool
  • Access: public

Parameters:

int|array $types — The type(s) of tokens to search for.
int $start — The position to start searching from in the token stack. The first token matching on this line before this token will be returned.
bool $exclude — If true, find the token that is NOT of the types specified in $types.
string $value — The value that the token must be equal to. If value is ommited, tokens with any value will be returned.

[ Top ]

findNext [line 1934]

int findNext( int|array $types, int $start, [int $end = null], [bool $exclude = false], [string $value = null], [bool $local = false])

Returns the position of the next specified token(s).

If a value is specified, the next token of the specified type(s) containing the specified value will be returned.

Returns false if no token can be found.


Parameters:

int|array $types — The type(s) of tokens to search for.
int $start — The position to start searching from in the token stack.
int $end — The end position to fail if no token is found. if not specified or null, end will default to the end of the token stack.
bool $exclude — If true, find the next token that are NOT of the types specified in $types.
string $value — The value that the token(s) must be equal to. If value is ommited, tokens with any value will be returned.
bool $local — If true, tokens outside the current statement will not be cheked. IE. checking will stop at the next semi-colon found.

[ Top ]

findPrevious [line 1864]

int findPrevious( int|array $types, int $start, [int $end = null], [bool $exclude = false], [string $value = null], [bool $local = false])

Returns the position of the next specified token(s).

If a value is specified, the next token of the specified type(s) containing the specified value will be returned.

Returns false if no token can be found.


Parameters:

int|array $types — The type(s) of tokens to search for.
int $start — The position to start searching from in the token stack.
int $end — The end position to fail if no token is found. if not specified or null, end will default to the start of the token stack.
bool $exclude — If true, find the next token that are NOT of the types specified in $types.
string $value — The value that the token(s) must be equal to. If value is ommited, tokens with any value will be returned.
bool $local — If true, tokens outside the current statement will not be cheked. IE. checking will stop at the next semi-colon found.

[ Top ]

getDeclarationName [line 1480]

string getDeclarationName( int $stackPtr)

Returns the declaration names for T_CLASS, T_INTERFACE and T_FUNCTION tokens.
  • Return: The name of the class, interface or function.
  • Throws: PHP_CodeSniffer_Exception If the specified token is not of type T_FUNCTION, T_CLASS or T_INTERFACE.
  • Access: public

Parameters:

int $stackPtr — The position of the declaration token which declared the class, interface or function.

[ Top ]

getErrorCount [line 593]

int getErrorCount( )

Returns the number of errors raised.
  • Access: public

[ Top ]

getErrors [line 617]

array getErrors( )

Returns the errors raised from processing this file.
  • Access: public

[ Top ]

getFilename [line 641]

string getFilename( )

Returns the absolute filename of this file.
  • Access: public

[ Top ]

getMemberProperties [line 1712]

array getMemberProperties( int $stackPtr)

Returns the visibility and implementation properies of the class member variable found at the specified position in the stack.

The format of the array is:

  1. array(
  2. 'scope' => 'public', // public private or protected
  3. 'is_static' => false, // true if the static keyword was found.
  4. );

  • Throws: PHP_CodeSniffer_Exception If the specified position is not a T_VARIABLE token, or if the position is not a class member variable.
  • Access: public

Parameters:

int $stackPtr — The position in the stack of the T_VARIABLE token to acquire the properties for.

[ Top ]

getMethodParameters [line 1516]

array() getMethodParameters( int $stackPtr)

Returns the method parameters for the specified T_FUNCTION token.

Each parameter is in the following format:

  1. 0 => array(
  2. 'name' => '$var', // The variable name.
  3. 'pass_by_reference' => false, // Passed by reference.
  4. 'type_hint' => string, // Type hint for array or custom type
  5. )

Parameters with default values have and additional array indice of 'default' with the value of the default as a string.

  • Throws: PHP_CodeSniffer_Exception If the specified $stackPtr is not of type T_FUNCTION.
  • Access: public

Parameters:

int $stackPtr — The position in the stack of the T_FUNCTION token to acquire the parameters for.

[ Top ]

getMethodProperties [line 1625]

array getMethodProperties( int $stackPtr)

Returns the visibility and implementation properies of a method.

The format of the array is:

  1. array(
  2. 'scope' => 'public', // public private or protected
  3. 'scope_specified' => true, // true is scope keyword was found.
  4. 'is_abstract' => false, // true if the abstract keyword was found.
  5. 'is_final' => false, // true if the final keyword was found.
  6. 'is_static' => false, // true if the static keyword was found.
  7. );

  • Throws: PHP_CodeSniffer_Exception If the specified position is not a T_FUNCTION token.
  • Access: public

Parameters:

int $stackPtr — The position in the stack of the T_FUNCTION token to acquire the properties for.

[ Top ]

getTokens [line 404]

array() getTokens( )

Returns the token stack for this file.
  • Access: public

[ Top ]

getTokensAsString [line 1825]

string getTokensAsString( int $start, int $length)

Returns the content of the tokens from the specified start position in the token stack for the specified legnth.
  • Return: The token contents.
  • Access: public

Parameters:

int $start — The position to start from in the token stack.
int $length — The length of tokens to traverse from the start pos.

[ Top ]

getValidScopeOpeners [line 1463]

array(int) getValidScopeOpeners( )

Returns the token types that are allowed to open scopes.
  • Access: public

[ Top ]

getWarningCount [line 605]

int getWarningCount( )

Returns the number of warnings raised.
  • Access: public

[ Top ]

getWarnings [line 629]

array getWarnings( )

Returns the warnings raised from processing this file.
  • Access: public

[ Top ]

hasCondition [line 2047]

boolean hasCondition( int $stackPtr, int|array $types)

Determine if the passed token has a condition of one of the passed types.
  • Access: public

Parameters:

int $stackPtr — The position of the token we are checking.
int|array $types — The type(s) of tokens to search for.

[ Top ]

isReference [line 1775]

boolean isReference( int $stackPtr)

Determine if the passed token is a reference operator.

Returns true if the specified token position represents a reference. Returns false if the token represents a bitwise operator.

  • Access: public

Parameters:

int $stackPtr — The position of the T_BITWISE_AND token.

[ Top ]

removeTokenListener [line 380]

void removeTokenListener( PHP_CodeSniffer_Sniff $listener, array $tokens)

Removes a listener from listening from the specified tokens.
  • Access: public

Parameters:

PHP_CodeSniffer_Sniff $listener — The listener to remove from the listener stack.
array(int) $tokens — The token types the listener wishes to stop listen to.

[ Top ]

start [line 416]

void start( )

Starts the stack traversal and tells listeners when tokens are found.
  • Access: public

[ Top ]

tokenizeString [line 659]

array tokenizeString( string $string, [string $eolChar = '\n'])

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

Parameters:

string $string — The string to tokenize.
string $eolChar — The EOL character to use for splitting strings.

[ Top ]


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

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