Documentation

Collections
in package

FinalYes

Collections of related tokens as often used and needed for sniffs.

These are additional "token groups" to compliment the ones available through the PHPCS native Tokens class.

Tags
see
Tokens

PHPCS native token groups.

see
BCTokens

Backward compatible version of the PHPCS native token groups.

since
1.0.0

Table of Contents

Properties

$alternativeControlStructureSyntaxClosers  : array<int, int>
Tokens representing alternative control structure syntax closer keywords.
$alternativeControlStructureSyntaxes  : array<int, int>
Tokens for control structures which can use the alternative control structure syntax.
$arrayOpenTokensBC  : array<int|string, int|string>
Tokens which can open an array (PHPCS cross-version compatible).
$arrayTokens  : array<int|string, int|string>
Tokens which are used to create arrays.
$classModifierKeywords  : array<int|string, int|string>
Modifier keywords which can be used for a class declaration.
$closedScopes  : array<int|string, int|string>
List of tokens which represent "closed" scopes.
$constantModifierKeywords  : array<int|string, int|string>
Modifier keywords which can be used for constant declarations (in OO structures).
$controlStructureTokens  : array<int|string, int|string>
Control structure tokens.
$functionDeclarationTokens  : array<int|string, int|string>
Tokens which represent a keyword which starts a function declaration.
$incrementDecrementOperators  : array<int, int>
Increment/decrement operator tokens.
$listOpenTokensBC  : array<int|string, int|string>
Tokens which can open a list construct (PHPCS cross-version compatible).
$listTokens  : array<int|string, int|string>
Tokens which are used to create lists.
$namespaceDeclarationClosers  : array<int|string, int|string>
List of tokens which can end a namespace declaration statement.
$nameTokens  : array<int|string, int|string>
Tokens used for "names", be it namespace, OO, function or constant names.
$objectOperators  : array<int|string, int|string>
Object operator tokens.
$ooCanExtend  : array<int|string, int|string>
OO structures which can use the "extends" keyword.
$ooCanImplement  : array<int|string, int|string>
OO structures which can use the "implements" keyword.
$ooConstantScopes  : array<int|string, int|string>
OO scopes in which constants can be declared.
$ooHierarchyKeywords  : array<int|string, int|string>
Tokens types used for "forwarding" calls within OO structures.
$ooPropertyScopes  : array<int|string, int|string>
OO scopes in which properties can be declared.
$parameterTypeTokens  : array<int|string, int|string>
Token types which can be encountered in a parameter type declaration.
$phpOpenTags  : array<int, int>
Tokens which open PHP.
$propertyModifierKeywords  : array<int|string, int|string>
Modifier keywords which can be used for a property declaration.
$propertyTypeTokens  : array<int|string, int|string>
Token types which can be encountered in a property type declaration.
$returnTypeTokens  : array<int|string, int|string>
Token types which can be encountered in a return type declaration.
$shortArrayListOpenTokensBC  : array<int|string, int|string>
Tokens which can open a short array or short list (PHPCS cross-version compatible).
$shortArrayTokens  : array<int|string, int|string>
Tokens which are used for short arrays.
$shortListTokens  : array<int|string, int|string>
Tokens which are used for short lists.
$textStringStartTokens  : array<int|string, int|string>
Tokens which can start a - potentially multi-line - text string.

Methods

__callStatic()  : array<int|string, int|string>
Handle calls to (undeclared) methods for token arrays which don't need special handling.
alternativeControlStructureSyntaxClosers()  : array<string|int, mixed>
alternativeControlStructureSyntaxes()  : array<string|int, mixed>
arrayOpenTokensBC()  : array<int|string, int|string>
Tokens which can open an array (PHPCS cross-version compatible).
arrayTokens()  : array<string|int, mixed>
arrayTokensBC()  : array<int|string, int|string>
Tokens which are used to create arrays (PHPCS cross-version compatible).
classModifierKeywords()  : array<string|int, mixed>
closedScopes()  : array<string|int, mixed>
constantModifierKeywords()  : array<string|int, mixed>
controlStructureTokens()  : array<string|int, mixed>
functionCallTokens()  : array<int|string, int|string>
Tokens which can represent function calls and function-call-like language constructs.
functionDeclarationTokens()  : array<string|int, mixed>
incrementDecrementOperators()  : array<string|int, mixed>
listOpenTokensBC()  : array<int|string, int|string>
Tokens which can open a list construct (PHPCS cross-version compatible).
listTokens()  : array<string|int, mixed>
listTokensBC()  : array<int|string, int|string>
Tokens which are used to create lists (PHPCS cross-version compatible).
namespaceDeclarationClosers()  : array<string|int, mixed>
namespacedNameTokens()  : array<int|string, int|string>
Tokens types which can be encountered in a fully, partially or unqualified name.
nameTokens()  : array<string|int, mixed>
objectOperators()  : array<string|int, mixed>
ooCanExtend()  : array<string|int, mixed>
ooCanImplement()  : array<string|int, mixed>
ooConstantScopes()  : array<string|int, mixed>
ooHierarchyKeywords()  : array<string|int, mixed>
ooPropertyScopes()  : array<string|int, mixed>
parameterPassingTokens()  : array<int|string, int|string>
Tokens which can be passed to the methods in the PassedParameter class.
parameterTypeTokens()  : array<int|string, int|string>
Token types which can be encountered in a parameter type declaration.
phpOpenTags()  : array<string|int, mixed>
propertyModifierKeywords()  : array<string|int, mixed>
propertyTypeTokens()  : array<int|string, int|string>
Token types which can be encountered in a property type declaration.
returnTypeTokens()  : array<int|string, int|string>
Token types which can be encountered in a return type declaration.
shortArrayListOpenTokensBC()  : array<int|string, int|string>
Tokens which can open a short array or short list (PHPCS cross-version compatible).
shortArrayTokens()  : array<string|int, mixed>
shortArrayTokensBC()  : array<int|string, int|string>
Tokens which are used for short arrays (PHPCS cross-version compatible).
shortListTokens()  : array<string|int, mixed>
shortListTokensBC()  : array<int|string, int|string>
Tokens which are used for short lists (PHPCS cross-version compatible).
textStringStartTokens()  : array<string|int, mixed>
triggerDeprecation()  : void
Throw a deprecation notice with a standardized deprecation message.

Properties

$alternativeControlStructureSyntaxClosers

Tokens representing alternative control structure syntax closer keywords.

private static array<int, int> $alternativeControlStructureSyntaxClosers = [\T_ENDIF => \T_ENDIF, \T_ENDFOR => \T_ENDFOR, \T_ENDFOREACH => \T_ENDFOREACH, \T_ENDWHILE => \T_ENDWHILE, \T_ENDSWITCH => \T_ENDSWITCH, \T_ENDDECLARE => \T_ENDDECLARE]
Tags
since
1.0.0

Use the Collections::alternativeControlStructureSyntaxClosers() method for access.

$alternativeControlStructureSyntaxes

Tokens for control structures which can use the alternative control structure syntax.

private static array<int, int> $alternativeControlStructureSyntaxes = [\T_IF => \T_IF, \T_ELSEIF => \T_ELSEIF, \T_ELSE => \T_ELSE, \T_FOR => \T_FOR, \T_FOREACH => \T_FOREACH, \T_SWITCH => \T_SWITCH, \T_WHILE => \T_WHILE, \T_DECLARE => \T_DECLARE]
Tags
since
1.0.0

Use the Collections::alternativeControlStructureSyntaxes() method for access.

$arrayOpenTokensBC

Tokens which can open an array (PHPCS cross-version compatible).

private static array<int|string, int|string> $arrayOpenTokensBC = [\T_ARRAY => \T_ARRAY, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY]

Should only be used selectively. Depending on the PHPCS version, the token array will be expanded in the associated method.

Tags
see
Collections::arrayTokensBC()

Related method to retrieve tokens used for arrays (PHPCS cross-version).

see
Collections::shortArrayTokensBC()

Related method to retrieve only tokens used for short arrays (PHPCS cross-version).

since
1.0.0

Use the Collections::arrayOpenTokensBC() method for access.

$arrayTokens

Tokens which are used to create arrays.

private static array<int|string, int|string> $arrayTokens = [\T_ARRAY => \T_ARRAY, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]
Tags
see
Collections::arrayOpenTokensBC()

Related method to retrieve only the "open" tokens used for arrays (PHPCS cross-version compatible).

see
Collections::arrayTokensBC()

Related method to retrieve tokens used for arrays (PHPCS cross-version compatible).

see
Collections::shortArrayTokens()

Related method to retrieve only tokens used for short arrays.

since
1.0.0

Use the Collections::arrayTokens() method for access.

$classModifierKeywords

Modifier keywords which can be used for a class declaration.

private static array<int|string, int|string> $classModifierKeywords = [\T_FINAL => \T_FINAL, \T_ABSTRACT => \T_ABSTRACT, \T_READONLY => \T_READONLY]
Tags
since
1.0.0

Use the Collections::classModifierKeywords() method for access.

$closedScopes

List of tokens which represent "closed" scopes.

private static array<int|string, int|string> $closedScopes = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_INTERFACE => \T_INTERFACE, \T_TRAIT => \T_TRAIT, \T_ENUM => \T_ENUM, \T_FUNCTION => \T_FUNCTION, \T_CLOSURE => \T_CLOSURE]

I.e. anything declared within that scope - except for other closed scopes - is outside of the global namespace.

This list doesn't contain the T_NAMESPACE token on purpose as variables declared within a namespace scope are still global and not limited to that namespace.

Tags
since
1.0.0

Use the Collections::closedScopes() method for access.

$constantModifierKeywords

Modifier keywords which can be used for constant declarations (in OO structures).

private static array<int|string, int|string> $constantModifierKeywords = [\T_PUBLIC => \T_PUBLIC, \T_PRIVATE => \T_PRIVATE, \T_PROTECTED => \T_PROTECTED, \T_FINAL => \T_FINAL]
  • PHP 7.1 added class constants visibility support.
  • PHP 8.1 added support for final class constants.
Tags
since
1.0.0

Use the Collections::constantModifierKeywords() method for access.

$controlStructureTokens

Control structure tokens.

private static array<int|string, int|string> $controlStructureTokens = [\T_IF => \T_IF, \T_ELSEIF => \T_ELSEIF, \T_ELSE => \T_ELSE, \T_FOR => \T_FOR, \T_FOREACH => \T_FOREACH, \T_SWITCH => \T_SWITCH, \T_DO => \T_DO, \T_WHILE => \T_WHILE, \T_DECLARE => \T_DECLARE, \T_MATCH => \T_MATCH]
Tags
since
1.0.0

Use the Collections::controlStructureTokens() method for access.

$functionDeclarationTokens

Tokens which represent a keyword which starts a function declaration.

private static array<int|string, int|string> $functionDeclarationTokens = [\T_FUNCTION => \T_FUNCTION, \T_CLOSURE => \T_CLOSURE, \T_FN => \T_FN]
Tags
since
1.0.0

Use the Collections::functionDeclarationTokens() method for access.

$incrementDecrementOperators

Increment/decrement operator tokens.

private static array<int, int> $incrementDecrementOperators = [\T_DEC => \T_DEC, \T_INC => \T_INC]
Tags
since
1.0.0

Use the Collections::incrementDecrementOperators() method for access.

$listOpenTokensBC

Tokens which can open a list construct (PHPCS cross-version compatible).

private static array<int|string, int|string> $listOpenTokensBC = [\T_LIST => \T_LIST, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY]

Should only be used selectively. Depending on the PHPCS version, the token array will be expanded in the associated method.

Tags
see
Collections::listTokensBC()

Related method to retrieve tokens used for lists (PHPCS cross-version).

see
Collections::shortListTokensBC()

Related method to retrieve only tokens used for short lists (PHPCS cross-version).

since
1.0.0

Use the Collections::listOpenTokensBC() method for access.

$listTokens

Tokens which are used to create lists.

private static array<int|string, int|string> $listTokens = [\T_LIST => \T_LIST, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]
Tags
see
Collections::listTokensBC()

Related method to retrieve tokens used for lists (PHPCS cross-version).

see
Collections::shortListTokens()

Related method to retrieve only tokens used for short lists.

since
1.0.0

Use the Collections::listTokens() method for access.

$namespaceDeclarationClosers

List of tokens which can end a namespace declaration statement.

private static array<int|string, int|string> $namespaceDeclarationClosers = [\T_SEMICOLON => \T_SEMICOLON, \T_OPEN_CURLY_BRACKET => \T_OPEN_CURLY_BRACKET, \T_CLOSE_TAG => \T_CLOSE_TAG]
Tags
since
1.0.0

Use the Collections::namespaceDeclarationClosers() method for access.

$nameTokens

Tokens used for "names", be it namespace, OO, function or constant names.

private static array<int|string, int|string> $nameTokens = [\T_STRING => \T_STRING, \T_NAME_QUALIFIED => \T_NAME_QUALIFIED, \T_NAME_FULLY_QUALIFIED => \T_NAME_FULLY_QUALIFIED, \T_NAME_RELATIVE => \T_NAME_RELATIVE]

Includes the tokens introduced in PHP 8.0 for "Namespaced names as single token".

Note: the PHP 8.0 namespaced name tokens are backfilled in PHPCS since PHPCS 3.5.7, but are not used yet (the PHP 8.0 tokenization is "undone" in PHPCS). As of PHPCS 4.0.0, these tokens will be used and the PHP 8.0 tokenization is respected.

Tags
link

PHP RFC on namespaced names as single token

since
1.0.0

Use the Collections::nameTokens() method for access.

$objectOperators

Object operator tokens.

private static array<int|string, int|string> $objectOperators = [\T_DOUBLE_COLON => \T_DOUBLE_COLON, \T_OBJECT_OPERATOR => \T_OBJECT_OPERATOR, \T_NULLSAFE_OBJECT_OPERATOR => \T_NULLSAFE_OBJECT_OPERATOR]
Tags
since
1.0.0

Use the Collections::objectOperators() method for access.

$ooCanExtend

OO structures which can use the "extends" keyword.

private static array<int|string, int|string> $ooCanExtend = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_INTERFACE => \T_INTERFACE]
Tags
since
1.0.0

Use the Collections::ooCanExtend() method for access.

$ooCanImplement

OO structures which can use the "implements" keyword.

private static array<int|string, int|string> $ooCanImplement = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_ENUM => \T_ENUM]
Tags
since
1.0.0

Use the Collections::ooCanImplement() method for access.

$ooConstantScopes

OO scopes in which constants can be declared.

private static array<int|string, int|string> $ooConstantScopes = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_INTERFACE => \T_INTERFACE, \T_ENUM => \T_ENUM, \T_TRAIT => \T_TRAIT]

Note: traits can only declare constants since PHP 8.2.

Tags
since
1.0.0

Use the Collections::ooConstantScopes() method for access.

$ooHierarchyKeywords

Tokens types used for "forwarding" calls within OO structures.

private static array<int|string, int|string> $ooHierarchyKeywords = [\T_PARENT => \T_PARENT, \T_SELF => \T_SELF, \T_STATIC => \T_STATIC]
Tags
link

PHP Manual on OO forwarding calls

since
1.0.0

Use the Collections::ooHierarchyKeywords() method for access.

$ooPropertyScopes

OO scopes in which properties can be declared.

private static array<int|string, int|string> $ooPropertyScopes = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_TRAIT => \T_TRAIT]

Note: interfaces can not declare properties.

Tags
since
1.0.0

Use the Collections::ooPropertyScopes() method for access.

$parameterTypeTokens

Token types which can be encountered in a parameter type declaration.

private static array<int|string, int|string> $parameterTypeTokens = [\T_CALLABLE => \T_CALLABLE, \T_SELF => \T_SELF, \T_PARENT => \T_PARENT, \T_FALSE => \T_FALSE, \T_TRUE => \T_TRUE, \T_NULL => \T_NULL, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION, \T_TYPE_OPEN_PARENTHESIS => \T_TYPE_OPEN_PARENTHESIS, \T_TYPE_CLOSE_PARENTHESIS => \T_TYPE_CLOSE_PARENTHESIS]
Tags
since
1.0.0

Use the Collections::parameterTypeTokens() method for access.

$phpOpenTags

Tokens which open PHP.

private static array<int, int> $phpOpenTags = [\T_OPEN_TAG => \T_OPEN_TAG, \T_OPEN_TAG_WITH_ECHO => \T_OPEN_TAG_WITH_ECHO]
Tags
since
1.0.0

Use the Collections::phpOpenTags() method for access.

$propertyModifierKeywords

Modifier keywords which can be used for a property declaration.

private static array<int|string, int|string> $propertyModifierKeywords = [\T_PUBLIC => \T_PUBLIC, \T_PRIVATE => \T_PRIVATE, \T_PROTECTED => \T_PROTECTED, \T_STATIC => \T_STATIC, \T_VAR => \T_VAR, \T_READONLY => \T_READONLY]
Tags
since
1.0.0

Use the Collections::propertyModifierKeywords() method for access.

$propertyTypeTokens

Token types which can be encountered in a property type declaration.

private static array<int|string, int|string> $propertyTypeTokens = [ \T_CALLABLE => \T_CALLABLE, // Not allowed in PHP, but in this list to allow for flagging code errors. \T_SELF => \T_SELF, \T_PARENT => \T_PARENT, \T_FALSE => \T_FALSE, \T_TRUE => \T_TRUE, \T_NULL => \T_NULL, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION, \T_TYPE_OPEN_PARENTHESIS => \T_TYPE_OPEN_PARENTHESIS, \T_TYPE_CLOSE_PARENTHESIS => \T_TYPE_CLOSE_PARENTHESIS, ]
Tags
since
1.0.0

Use the Collections::propertyTypeTokens() method for access.

$returnTypeTokens

Token types which can be encountered in a return type declaration.

private static array<int|string, int|string> $returnTypeTokens = [\T_CALLABLE => \T_CALLABLE, \T_FALSE => \T_FALSE, \T_TRUE => \T_TRUE, \T_NULL => \T_NULL, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION, \T_TYPE_OPEN_PARENTHESIS => \T_TYPE_OPEN_PARENTHESIS, \T_TYPE_CLOSE_PARENTHESIS => \T_TYPE_CLOSE_PARENTHESIS]
Tags
since
1.0.0

Use the Collections::returnTypeTokens() method for access.

$shortArrayListOpenTokensBC

Tokens which can open a short array or short list (PHPCS cross-version compatible).

private static array<int|string, int|string> $shortArrayListOpenTokensBC = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY]

Should only be used selectively. Depending on the PHPCS version, the token array will be expanded in the associated method.

Tags
since
1.0.0

Use the Collections::shortArrayListOpenTokensBC() method for access.

$shortArrayTokens

Tokens which are used for short arrays.

private static array<int|string, int|string> $shortArrayTokens = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]
Tags
see
Collections::arrayTokens()

Related method to retrieve all tokens used for arrays.

since
1.0.0

Use the Collections::shortArrayTokens() method for access.

$shortListTokens

Tokens which are used for short lists.

private static array<int|string, int|string> $shortListTokens = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]
Tags
see
Collections::listTokens()

Related method to retrieve all tokens used for lists.

since
1.0.0

Use the Collections::shortListTokens() method for access.

$textStringStartTokens

Tokens which can start a - potentially multi-line - text string.

private static array<int|string, int|string> $textStringStartTokens = [\T_START_HEREDOC => \T_START_HEREDOC, \T_START_NOWDOC => \T_START_NOWDOC, \T_CONSTANT_ENCAPSED_STRING => \T_CONSTANT_ENCAPSED_STRING, \T_DOUBLE_QUOTED_STRING => \T_DOUBLE_QUOTED_STRING]
Tags
since
1.0.0

Use the Collections::textStringStartTokens() method for access.

Methods

__callStatic()

Handle calls to (undeclared) methods for token arrays which don't need special handling.

public static __callStatic(string $name, array<string|int, mixed> $args) : array<int|string, int|string>
Parameters
$name : string

The name of the method which has been called.

$args : array<string|int, mixed>

Any arguments passed to the method. Unused as none of the methods take arguments.

Tags
since
1.0.0
throws
InvalidTokenArray

When an invalid token array is requested.

Return values
array<int|string, int|string>

Token array

alternativeControlStructureSyntaxClosers()

public static alternativeControlStructureSyntaxClosers() : array<string|int, mixed>

Tokens representing alternative control structure syntax closer keywords.

Return values
array<string|int, mixed>

alternativeControlStructureSyntaxes()

public static alternativeControlStructureSyntaxes() : array<string|int, mixed>

Tokens for control structures which can use the alternative control structure syntax.

Return values
array<string|int, mixed>

arrayOpenTokensBC()

Tokens which can open an array (PHPCS cross-version compatible).

public static arrayOpenTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::arrayTokensBC()

Related method to retrieve tokens used for arrays (PHPCS cross-version).

see
Collections::shortArrayTokensBC()

Related method to retrieve only tokens used for short arrays (PHPCS cross-version).

since
1.0.0
Return values
array<int|string, int|string>

arrayTokens()

public static arrayTokens() : array<string|int, mixed>

Tokens which are used to create arrays.

Return values
array<string|int, mixed>

arrayTokensBC()

Tokens which are used to create arrays (PHPCS cross-version compatible).

public static arrayTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::arrayOpenTokensBC()

Related method to retrieve only the "open" tokens used for arrays (PHPCS cross-version compatible).

see
Collections::shortArrayTokensBC()

Related method to retrieve only tokens used for short arrays (PHPCS cross-version compatible).

since
1.0.0
Return values
array<int|string, int|string>

classModifierKeywords()

public static classModifierKeywords() : array<string|int, mixed>

Modifier keywords which can be used for a class declaration.

Return values
array<string|int, mixed>

closedScopes()

public static closedScopes() : array<string|int, mixed>

List of tokens which represent "closed" scopes.

Return values
array<string|int, mixed>

constantModifierKeywords()

public static constantModifierKeywords() : array<string|int, mixed>

Tokens which can be used as modifiers for a constant declaration (in OO structures).

Return values
array<string|int, mixed>

controlStructureTokens()

public static controlStructureTokens() : array<string|int, mixed>

Control structure tokens.

Return values
array<string|int, mixed>

functionCallTokens()

Tokens which can represent function calls and function-call-like language constructs.

public static functionCallTokens() : array<int|string, int|string>
Tags
see
Collections::parameterPassingTokens()

Related method.

since
1.0.0
Return values
array<int|string, int|string>

functionDeclarationTokens()

public static functionDeclarationTokens() : array<string|int, mixed>

Tokens which represent a keyword which starts a function declaration.

Return values
array<string|int, mixed>

incrementDecrementOperators()

public static incrementDecrementOperators() : array<string|int, mixed>

Increment/decrement operator tokens.

Return values
array<string|int, mixed>

listOpenTokensBC()

Tokens which can open a list construct (PHPCS cross-version compatible).

public static listOpenTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::listTokensBC()

Related method to retrieve tokens used for lists (PHPCS cross-version).

see
Collections::shortListTokensBC()

Related method to retrieve only tokens used for short lists (PHPCS cross-version).

since
1.0.0
Return values
array<int|string, int|string>

listTokens()

public static listTokens() : array<string|int, mixed>

Tokens which are used to create lists.

Return values
array<string|int, mixed>

listTokensBC()

Tokens which are used to create lists (PHPCS cross-version compatible).

public static listTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::shortListTokensBC()

Related method to retrieve only tokens used for short lists (cross-version).

since
1.0.0
Return values
array<int|string, int|string>

namespaceDeclarationClosers()

public static namespaceDeclarationClosers() : array<string|int, mixed>

List of tokens which can end a namespace declaration statement.

Return values
array<string|int, mixed>

namespacedNameTokens()

Tokens types which can be encountered in a fully, partially or unqualified name.

public static namespacedNameTokens() : array<int|string, int|string>

Example:

echo namespace\Sub\ClassName::method();
Tags
since
1.0.0
Return values
array<int|string, int|string>

nameTokens()

public static nameTokens() : array<string|int, mixed>

Tokens used for "names", be it namespace, OO, function or constant names.

Return values
array<string|int, mixed>

objectOperators()

public static objectOperators() : array<string|int, mixed>

Object operator tokens.

Return values
array<string|int, mixed>

ooCanExtend()

public static ooCanExtend() : array<string|int, mixed>

OO structures which can use the "extends" keyword.

Return values
array<string|int, mixed>

ooCanImplement()

public static ooCanImplement() : array<string|int, mixed>

OO structures which can use the "implements" keyword.

Return values
array<string|int, mixed>

ooConstantScopes()

public static ooConstantScopes() : array<string|int, mixed>

OO scopes in which constants can be declared.

Return values
array<string|int, mixed>

ooHierarchyKeywords()

public static ooHierarchyKeywords() : array<string|int, mixed>

Tokens types used for "forwarding" calls within OO structures.

Return values
array<string|int, mixed>

ooPropertyScopes()

public static ooPropertyScopes() : array<string|int, mixed>

OO scopes in which properties can be declared.

Return values
array<string|int, mixed>

parameterPassingTokens()

Tokens which can be passed to the methods in the PassedParameter class.

public static parameterPassingTokens() : array<int|string, int|string>
Tags
see
PassedParameters
since
1.0.0
Return values
array<int|string, int|string>

parameterTypeTokens()

Token types which can be encountered in a parameter type declaration.

public static parameterTypeTokens() : array<int|string, int|string>
Tags
since
1.0.0
Return values
array<int|string, int|string>

phpOpenTags()

public static phpOpenTags() : array<string|int, mixed>

Tokens which open PHP.

Return values
array<string|int, mixed>

propertyModifierKeywords()

public static propertyModifierKeywords() : array<string|int, mixed>

Modifier keywords which can be used for a property declaration.

Return values
array<string|int, mixed>

propertyTypeTokens()

Token types which can be encountered in a property type declaration.

public static propertyTypeTokens() : array<int|string, int|string>
Tags
since
1.0.0
Return values
array<int|string, int|string>

returnTypeTokens()

Token types which can be encountered in a return type declaration.

public static returnTypeTokens() : array<int|string, int|string>
Tags
since
1.0.0
Return values
array<int|string, int|string>

shortArrayListOpenTokensBC()

Tokens which can open a short array or short list (PHPCS cross-version compatible).

public static shortArrayListOpenTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
since
1.0.0
Return values
array<int|string, int|string>

shortArrayTokens()

public static shortArrayTokens() : array<string|int, mixed>

Tokens which are used for short arrays.

Return values
array<string|int, mixed>

shortArrayTokensBC()

Tokens which are used for short arrays (PHPCS cross-version compatible).

public static shortArrayTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::arrayTokensBC()

Related method to retrieve all tokens used for arrays (cross-version).

since
1.0.0
Return values
array<int|string, int|string>

shortListTokens()

public static shortListTokens() : array<string|int, mixed>

Tokens which are used for short lists.

Return values
array<string|int, mixed>

shortListTokensBC()

Tokens which are used for short lists (PHPCS cross-version compatible).

public static shortListTokensBC() : array<int|string, int|string>

For those PHPCS versions which need it, includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

Tags
see
Collections::listTokensBC()

Related method to retrieve all tokens used for lists (cross-version).

since
1.0.0
Return values
array<int|string, int|string>

textStringStartTokens()

public static textStringStartTokens() : array<string|int, mixed>

Tokens which can start a - potentially multi-line - text string.

Return values
array<string|int, mixed>

triggerDeprecation()

Throw a deprecation notice with a standardized deprecation message.

private static triggerDeprecation(string $method, string $version, string $replacement) : void
Parameters
$method : string

The name of the method which is deprecated.

$version : string

The version since which the method is deprecated.

$replacement : string

What to use instead.

Tags
since
1.0.0

        
On this page

Search results