$endScopeTokens = array(
T_CLOSE_CURLY_BRACKET => T_CLOSE_CURLY_BRACKET,
T_BREAK => T_BREAK,
T_END_HEREDOC => T_END_HEREDOC,
)
[line 258]
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.
$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_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),'end'=>array(T_CLOSE_CURLY_BRACKET=>T_CLOSE_CURLY_BRACKET),'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 39]
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.
processAdditional [line 739]
void processAdditional(
&$tokens, string
$eolChar, array
$tokens)
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.
Overridden in child classes as:
- PHP_CodeSniffer_Tokenizers_CSS::processAdditional()
- Performs additional processing after main tokenizing.
Parameters:
array
$tokens
—
The array of tokens to process.
string
$eolChar
—
The EOL character to use for splitting strings.
&$tokens
—
resolveSimpleToken [line 1046]
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.
standardiseToken [line 965]
array standardiseToken(
string|array
$token)
Takes a token produced from
and produces a more uniform token.
- Return: The new token.
- Access: public
Parameters:
string|array
$token
—
The token to convert.
tokenizeString [line 284]
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.
Overridden in child classes as:
- PHP_CodeSniffer_Tokenizers_CSS::tokenizeString()
- Creates an array of tokens when given some CSS code.
Parameters:
string
$string
—
The string to tokenize.
string
$eolChar
—
The EOL character to use for splitting strings.