$endScopeTokens = array(
T_CLOSE_CURLY_BRACKET,
T_BREAK,
T_END_HEREDOC,
)
[line 255]
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_COLON,
),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDIF,T_ELSE,T_ELSEIF,),'strict'=>false,'shared'=>false,'with'=>array(T_ELSE,T_ELSEIF,),),T_TRY=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CATCH=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_FINALLY=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_ELSE=>array('start'=>array(T_OPEN_CURLY_BRACKET,T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDIF,),'strict'=>false,'shared'=>false,'with'=>array(T_IF,T_ELSEIF,),),T_ELSEIF=>array('start'=>array(T_OPEN_CURLY_BRACKET,T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDIF,T_ELSE,T_ELSEIF,),'strict'=>false,'shared'=>false,'with'=>array(T_IF,T_ELSE,),),T_FOR=>array('start'=>array(T_OPEN_CURLY_BRACKET,T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDFOR,),'strict'=>false,'shared'=>false,'with'=>array(),),T_FOREACH=>array('start'=>array(T_OPEN_CURLY_BRACKET,T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDFOREACH,),'strict'=>false,'shared'=>false,'with'=>array(),),T_INTERFACE=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_FUNCTION=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CLASS=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_TRAIT=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_NAMESPACE=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>false,'shared'=>false,'with'=>array(),),T_WHILE=>array('start'=>array(T_OPEN_CURLY_BRACKET,T_COLON,),'end'=>array(T_CLOSE_CURLY_BRACKET,T_ENDWHILE,),'strict'=>false,'shared'=>false,'with'=>array(),),T_DO=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_SWITCH=>array('start'=>array(T_OPEN_CURLY_BRACKET),'end'=>array(T_CLOSE_CURLY_BRACKET),'strict'=>true,'shared'=>false,'with'=>array(),),T_CASE=>array('start'=>array(T_COLON,T_SEMICOLON,),'end'=>array(T_BREAK,T_RETURN,T_CONTINUE,T_THROW,T_EXIT,),'strict'=>true,'shared'=>true,'with'=>array(T_DEFAULT,T_CASE,T_SWITCH,),),T_DEFAULT=>array('start'=>array(T_COLON),'end'=>array(T_BREAK,T_RETURN,T_CONTINUE,T_THROW,T_EXIT,),'strict'=>true,'shared'=>true,'with'=>array(T_CASE,T_SWITCH,),),T_START_HEREDOC=>array('start'=>array(T_START_HEREDOC),'end'=>array(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 639]
void processAdditional(
array
&$tokens, string
$eolChar)
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.
tokenizeString [line 273]
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.