PHPCSUtils

Collections
in package

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
since
1.0.0-alpha4

Dropped support for PHPCS < 3.7.1.

since
1.0.0-alpha4

Direct property access is deprecated for forward-compatibility reasons. Use the methods of the same name as the property instead.

Table of Contents

$alternativeControlStructureSyntaxCloserTokens  : array<string|int, mixed>
DEPRECATED: Tokens representing alternative control structure syntax closer keywords.
$alternativeControlStructureSyntaxTokens  : array<string|int, mixed>
DEPRECATED: Tokens for control structures which can use the alternative control structure syntax.
$arrayTokens  : array<string|int, mixed>
DEPRECATED: Tokens which are used to create arrays.
$arrayTokensBC  : array<string|int, mixed>
DEPRECATED: Tokens which are used to create arrays (PHPCS cross-version compatible).
$classModifierKeywords  : array<string|int, mixed>
DEPRECATED: Modifier keywords which can be used for a class declaration.
$closedScopes  : array<string|int, mixed>
DEPRECATED: List of tokens which represent "closed" scopes.
$controlStructureTokens  : array<string|int, mixed>
DEPRECATED: Control structure tokens.
$incrementDecrementOperators  : array<string|int, mixed>
DEPRECATED: Increment/decrement operator tokens.
$listTokens  : array<string|int, mixed>
DEPRECATED: Tokens which are used to create lists.
$listTokensBC  : array<string|int, mixed>
DEPRECATED: Tokens which are used to create lists (PHPCS cross-version compatible).
$magicConstants  : array<string|int, mixed>
DEPRECATED: Tokens for the PHP magic constants.
$namespaceDeclarationClosers  : array<string|int, mixed>
DEPRECATED: List of tokens which can end a namespace declaration statement.
$objectOperators  : array<string|int, mixed>
DEPRECATED: Object operator tokens.
$OOCanExtend  : array<string|int, mixed>
DEPRECATED: OO structures which can use the "extends" keyword.
$OOCanImplement  : array<string|int, mixed>
DEPRECATED: OO structures which can use the "implements" keyword.
$OOConstantScopes  : array<string|int, mixed>
DEPRECATED: OO scopes in which constants can be declared.
$OOHierarchyKeywords  : array<string|int, mixed>
DEPRECATED: Tokens types used for "forwarding" calls within OO structures.
$OONameTokens  : array<string|int, mixed>
DEPRECATED: Tokens types which can be encountered in the fully/partially qualified name of an OO structure.
$OOPropertyScopes  : array<string|int, mixed>
DEPRECATED: OO scopes in which properties can be declared.
$parameterTypeTokens  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a parameter type declaration.
$propertyModifierKeywords  : array<string|int, mixed>
DEPRECATED: Modifier keywords which can be used for a property declaration.
$propertyTypeTokens  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a property type declaration.
$returnTypeTokens  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a return type declaration.
$shortArrayTokens  : array<string|int, mixed>
DEPRECATED: Tokens which are used for short arrays.
$shortArrayTokensBC  : array<string|int, mixed>
DEPRECATED: Tokens which are used for short arrays (PHPCS cross-version compatible).
$shortListTokens  : array<string|int, mixed>
DEPRECATED: Tokens which are used for short lists.
$shortListTokensBC  : array<string|int, mixed>
DEPRECATED: Tokens which are used for short lists (PHPCS cross-version compatible).
$textStingStartTokens  : array<string|int, mixed>
DEPRECATED: Tokens which can start a - potentially multi-line - text string.
__callStatic()  : array<string|int, mixed>
Handle calls to (undeclared) methods for token arrays which don't need special handling.
alternativeControlStructureSyntaxClosers()  : array<string|int, mixed>
Tokens representing alternative control structure syntax closer keywords.
alternativeControlStructureSyntaxes()  : array<string|int, mixed>
Tokens for control structures which can use the alternative control structure syntax.
arrayOpenTokensBC()  : array<string|int, mixed>
arrayTokens()  : array<string|int, mixed>
arrayTokensBC()  : array<string|int, mixed>
arrowFunctionTokensBC()  : array<string|int, mixed>
DEPRECATED: Tokens which can represent the arrow function keyword.
classModifierKeywords()  : array<string|int, mixed>
closedScopes()  : array<string|int, mixed>
controlStructureTokens()  : array<string|int, mixed>
functionCallTokens()  : array<string|int, mixed>
Tokens which can represent function calls and function-call-like language constructs.
functionDeclarationTokens()  : array<string|int, mixed>
functionDeclarationTokensBC()  : array<string|int, mixed>
DEPRECATED: Tokens which represent a keyword which starts a function declaration.
incrementDecrementOperators()  : array<string|int, mixed>
listTokens()  : array<string|int, mixed>
listTokensBC()  : array<string|int, mixed>
namespaceDeclarationClosers()  : array<string|int, mixed>
namespacedNameTokens()  : array<string|int, mixed>
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>
OO structures which can use the "extends" keyword.
ooCanImplement()  : array<string|int, mixed>
OO structures which can use the "implements" keyword.
ooConstantScopes()  : array<string|int, mixed>
OO scopes in which constants can be declared.
ooHierarchyKeywords()  : array<string|int, mixed>
Tokens types used for "forwarding" calls within OO structures.
ooPropertyScopes()  : array<string|int, mixed>
OO scopes in which properties can be declared.
parameterPassingTokens()  : array<string|int, mixed>
Tokens which can be passed to the methods in the PassedParameter class.
parameterTypeTokens()  : array<string|int, mixed>
Token types which can be encountered in a parameter type declaration.
parameterTypeTokensBC()  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a parameter type declaration (cross-version).
phpOpenTags()  : array<string|int, mixed>
propertyModifierKeywords()  : array<string|int, mixed>
propertyTypeTokens()  : array<string|int, mixed>
Token types which can be encountered in a property type declaration.
propertyTypeTokensBC()  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a property type declaration (cross-version).
returnTypeTokens()  : array<string|int, mixed>
Token types which can be encountered in a return type declaration.
returnTypeTokensBC()  : array<string|int, mixed>
DEPRECATED: Token types which can be encountered in a return type declaration (cross-version).
shortArrayListOpenTokensBC()  : array<string|int, mixed>
shortArrayTokens()  : array<string|int, mixed>
shortArrayTokensBC()  : array<string|int, mixed>
shortListTokens()  : array<string|int, mixed>
shortListTokensBC()  : array<string|int, mixed>
textStringStartTokens()  : array<string|int, mixed>
Tokens which can start a - potentially multi-line - text string.

Properties

$alternativeControlStructureSyntaxCloserTokens

DEPRECATED: Tokens representing alternative control structure syntax closer keywords.

public static array<string|int, mixed> $alternativeControlStructureSyntaxCloserTokens = [\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-alpha2
deprecated
1.0.0-alpha4

Use the Collections::alternativeControlStructureSyntaxClosers() method instead.

$alternativeControlStructureSyntaxTokens

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

public static array<string|int, mixed> $alternativeControlStructureSyntaxTokens = [\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-alpha2
deprecated
1.0.0-alpha4

Use the Collections::alternativeControlStructureSyntaxes() method instead.

$arrayTokens

DEPRECATED: Tokens which are used to create arrays.

public static array<string|int, mixed> $arrayTokens = [\T_ARRAY => \T_ARRAY, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]

<int|string> => <int|string>

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-alpha1
deprecated
1.0.0-alpha4

Use the Collections::arrayTokens() method instead.

$arrayTokensBC

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

public static array<string|int, mixed> $arrayTokensBC = [\T_ARRAY => \T_ARRAY, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET, \T_CLOSE_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET]

Includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling intermittent tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

<int|string> => <int|string>

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-alpha1
deprecated
1.0.0-alpha4

Use the Collections::arrayTokensBC() method instead.

$classModifierKeywords

DEPRECATED: Modifier keywords which can be used for a class declaration.

public static array<string|int, mixed> $classModifierKeywords = [\T_FINAL => \T_FINAL, \T_ABSTRACT => \T_ABSTRACT, \T_READONLY => \T_READONLY]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the T_READONLY token for PHP 8.2 readonly classes.

deprecated
1.0.0-alpha4

Use the Collections::classModifierKeywords() method instead.

$closedScopes

DEPRECATED: List of tokens which represent "closed" scopes.

public static array<string|int, mixed> $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.

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the PHP 8.1 T_ENUM token.

deprecated
1.0.0-alpha4

Use the Collections::closedScopes() method instead.

$controlStructureTokens

DEPRECATED: Control structure tokens.

public static array<string|int, mixed> $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-alpha2
since
1.0.0-alpha4

Added the T_MATCH token for PHP 8.0 match expressions.

deprecated
1.0.0-alpha4

Use the Collections::controlStructureTokens() method instead.

$incrementDecrementOperators

DEPRECATED: Increment/decrement operator tokens.

public static array<string|int, mixed> $incrementDecrementOperators = [\T_DEC => \T_DEC, \T_INC => \T_INC]

=>

Tags
since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::incrementDecrementOperators() method instead.

$listTokens

DEPRECATED: Tokens which are used to create lists.

public static array<string|int, mixed> $listTokens = [\T_LIST => \T_LIST, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]

<int|string> => <int|string>

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-alpha1
deprecated
1.0.0-alpha4

Use the Collections::listTokens() method instead.

$listTokensBC

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

public static array<string|int, mixed> $listTokensBC = [\T_LIST => \T_LIST, \T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET, \T_CLOSE_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET]

Includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling intermittent tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

<int|string> => <int|string>

Tags
see
Collections::shortListTokensBC()

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

since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::listTokensBC() method instead.

$magicConstants

DEPRECATED: Tokens for the PHP magic constants.

public static array<string|int, mixed> $magicConstants = [\T_CLASS_C => \T_CLASS_C, \T_DIR => \T_DIR, \T_FILE => \T_FILE, \T_FUNC_C => \T_FUNC_C, \T_LINE => \T_LINE, \T_METHOD_C => \T_METHOD_C, \T_NS_C => \T_NS_C, \T_TRAIT_C => \T_TRAIT_C]

<int|string> => <int|string>

Tags
since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Tokens::$magicConstants property or the BCTokens::magicConstants() method instead.

$namespaceDeclarationClosers

DEPRECATED: List of tokens which can end a namespace declaration statement.

public static array<string|int, mixed> $namespaceDeclarationClosers = [\T_SEMICOLON => \T_SEMICOLON, \T_OPEN_CURLY_BRACKET => \T_OPEN_CURLY_BRACKET, \T_CLOSE_TAG => \T_CLOSE_TAG]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::namespaceDeclarationClosers() method instead.

$objectOperators

DEPRECATED: Object operator tokens.

public static array<string|int, mixed> $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-alpha3
since
1.0.0-alpha4

Added the PHP 8.0 T_NULLSAFE_OBJECT_OPERATOR token.

deprecated
1.0.0-alpha4

Use the Collections::objectOperators() method instead.

$OOCanExtend

DEPRECATED: OO structures which can use the "extends" keyword.

public static array<string|int, mixed> $OOCanExtend = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_INTERFACE => \T_INTERFACE]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::ooCanExtend() method instead.

$OOCanImplement

DEPRECATED: OO structures which can use the "implements" keyword.

public static array<string|int, mixed> $OOCanImplement = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_ENUM => \T_ENUM]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the PHP 8.1 T_ENUM token.

deprecated
1.0.0-alpha4

Use the Collections::ooCanImplement() method instead.

$OOConstantScopes

DEPRECATED: OO scopes in which constants can be declared.

public static array<string|int, mixed> $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.

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the PHP 8.1 T_ENUM token.

since
1.0.0-alpha4

Added the T_TRAIT token for PHP 8.2 constants in traits.

deprecated
1.0.0-alpha4

Use the Collections::ooConstantScopes() method instead.

$OOHierarchyKeywords

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

public static array<string|int, mixed> $OOHierarchyKeywords = [\T_PARENT => \T_PARENT, \T_SELF => \T_SELF, \T_STATIC => \T_STATIC]

<int|string> => <int|string>

Tags
link

PHP Manual on OO forwarding calls

since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::ooHierarchyKeywords() method instead.

$OONameTokens

DEPRECATED: Tokens types which can be encountered in the fully/partially qualified name of an OO structure.

public static array<string|int, mixed> $OONameTokens = [\T_NS_SEPARATOR => \T_NS_SEPARATOR, \T_STRING => \T_STRING, \T_NAMESPACE => \T_NAMESPACE]

<int|string> => <int|string>

Tags
since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::namespacedNameTokens() method instead.

$OOPropertyScopes

DEPRECATED: OO scopes in which properties can be declared.

public static array<string|int, mixed> $OOPropertyScopes = [\T_CLASS => \T_CLASS, \T_ANON_CLASS => \T_ANON_CLASS, \T_TRAIT => \T_TRAIT]

Note: interfaces can not declare properties.

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::ooPropertyScopes() method instead.

$parameterTypeTokens

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

public static array<string|int, mixed> $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_STRING => \T_STRING, \T_NS_SEPARATOR => \T_NS_SEPARATOR, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

deprecated
1.0.0-alpha4

Use the Collections::parameterTypeTokens() method instead.

$propertyModifierKeywords

DEPRECATED: Modifier keywords which can be used for a property declaration.

public static array<string|int, mixed> $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]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the T_READONLY token for PHP 8.1 readonly properties.

deprecated
1.0.0-alpha4

Use the Collections::propertyModifierKeywords() method instead.

$propertyTypeTokens

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

public static array<string|int, mixed> $propertyTypeTokens = [\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_STRING => \T_STRING, \T_NS_SEPARATOR => \T_NS_SEPARATOR, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

deprecated
1.0.0-alpha4

Use the Collections::propertyTypeTokens() method instead.

$returnTypeTokens

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

public static array<string|int, mixed> $returnTypeTokens = [\T_CALLABLE => \T_CALLABLE, \T_SELF => \T_SELF, \T_PARENT => \T_PARENT, \T_STATIC => \T_STATIC, \T_FALSE => \T_FALSE, \T_TRUE => \T_TRUE, \T_NULL => \T_NULL, \T_STRING => \T_STRING, \T_NS_SEPARATOR => \T_NS_SEPARATOR, \T_TYPE_UNION => \T_TYPE_UNION, \T_TYPE_INTERSECTION => \T_TYPE_INTERSECTION]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

deprecated
1.0.0-alpha4

Use the Collections::returnTypeTokens() method instead.

$shortArrayTokens

DEPRECATED: Tokens which are used for short arrays.

public static array<string|int, mixed> $shortArrayTokens = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]

<int|string> => <int|string>

Tags
see
Collections::arrayTokens()

Related method to retrieve all tokens used for arrays.

since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::shortArrayTokens() method instead.

$shortArrayTokensBC

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

public static array<string|int, mixed> $shortArrayTokensBC = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET, \T_CLOSE_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET]

Includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling intermittent tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

<int|string> => <int|string>

Tags
see
Collections::arrayTokensBC()

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

since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::shortArrayTokensBC() method instead.

$shortListTokens

DEPRECATED: Tokens which are used for short lists.

public static array<string|int, mixed> $shortListTokens = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY]

<int|string> => <int|string>

Tags
see
Collections::listTokens()

Related method to retrieve all tokens used for lists.

since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::shortListTokens() method instead.

$shortListTokensBC

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

public static array<string|int, mixed> $shortListTokensBC = [\T_OPEN_SHORT_ARRAY => \T_OPEN_SHORT_ARRAY, \T_CLOSE_SHORT_ARRAY => \T_CLOSE_SHORT_ARRAY, \T_OPEN_SQUARE_BRACKET => \T_OPEN_SQUARE_BRACKET, \T_CLOSE_SQUARE_BRACKET => \T_CLOSE_SQUARE_BRACKET]

Includes T_OPEN_SQUARE_BRACKET and T_CLOSE_SQUARE_BRACKET to allow for handling intermittent tokenizer issues related to the retokenization to T_OPEN_SHORT_ARRAY. Should only be used selectively.

<int|string> => <int|string>

Tags
see
Collections::listTokensBC()

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

since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::shortListTokensBC() method instead.

$textStingStartTokens

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

public static array<string|int, mixed> $textStingStartTokens = [\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]

<int|string> => <int|string>

Tags
since
1.0.0-alpha1
deprecated
1.0.0-alpha4

Use the Collections::textStringStartTokens() method instead.

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<string|int, mixed>
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-alpha4
throws
InvalidTokenArray

When an invalid token array is requested.

Return values
array<string|int, mixed>

<int|string> => <int|string> Token array

alternativeControlStructureSyntaxClosers()

Tokens representing alternative control structure syntax closer keywords.

public static alternativeControlStructureSyntaxClosers() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$alternativeControlStructureSyntaxCloserTokens property.

Return values
array<string|int, mixed>

=>

alternativeControlStructureSyntaxes()

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

public static alternativeControlStructureSyntaxes() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$alternativeControlStructureSyntaxTokens property.

Return values
array<string|int, mixed>

=>

arrayOpenTokensBC()

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

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

Return values
array<string|int, mixed>

arrayTokens()

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

Tokens which are used to create arrays.

Return values
array<string|int, mixed>

arrayTokensBC()

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

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

Return values
array<string|int, mixed>

arrowFunctionTokensBC()

DEPRECATED: Tokens which can represent the arrow function keyword.

public static arrowFunctionTokensBC() : array<string|int, mixed>
Tags
since
1.0.0-alpha2
deprecated
1.0.0-alpha4

Use the T_FN token constant instead.

Return values
array<string|int, mixed>

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

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<string|int, mixed>
Tags
see
Collections::parameterPassingTokens()

Related method.

since
1.0.0-alpha4
Return values
array<string|int, mixed>

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

functionDeclarationTokensBC()

DEPRECATED: Tokens which represent a keyword which starts a function declaration.

public static functionDeclarationTokensBC() : array<string|int, mixed>
Tags
since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::functionDeclarationTokens() method instead.

Return values
array<string|int, mixed>

<int|string> => <int|string>

incrementDecrementOperators()

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

Increment/decrement operator tokens.

Return values
array<string|int, mixed>

listTokens()

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

Tokens which are used to create lists.

Return values
array<string|int, mixed>

listTokensBC()

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

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

Return values
array<string|int, mixed>

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<string|int, mixed>

Example:

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

<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()

OO structures which can use the "extends" keyword.

public static ooCanExtend() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$OOCanExtend property.

Return values
array<string|int, mixed>

<int|string> => <int|string>

ooCanImplement()

OO structures which can use the "implements" keyword.

public static ooCanImplement() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$OOCanImplement property.

since
1.0.0-alpha4

Added the PHP 8.1 T_ENUM token.

Return values
array<string|int, mixed>

<int|string> => <int|string>

ooConstantScopes()

OO scopes in which constants can be declared.

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

Note: traits can only declare constants since PHP 8.2.

Tags
since
1.0.0-alpha4

This method replaces the Collections::$OOConstantScopes property.

since
1.0.0-alpha4

Added the PHP 8.1 T_ENUM token.

since
1.0.0-alpha4

Added the T_TRAIT token for PHP 8.2 constants in traits.

Return values
array<string|int, mixed>

<int|string> => <int|string>

ooPropertyScopes()

OO scopes in which properties can be declared.

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

Note: interfaces can not declare properties.

Tags
since
1.0.0-alpha4

This method replaces the Collections::$OOPropertyScopes property.

Return values
array<string|int, mixed>

<int|string> => <int|string>

parameterPassingTokens()

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

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

<int|string> => <int|string>

parameterTypeTokens()

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

public static parameterTypeTokens() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$parameterTypeTokens property.

since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added support for PHP 8.0 identifier name tokens.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

Return values
array<string|int, mixed>

<int|string> => <int|string>

parameterTypeTokensBC()

DEPRECATED: Token types which can be encountered in a parameter type declaration (cross-version).

public static parameterTypeTokensBC() : array<string|int, mixed>
Tags
see
Collections::parameterTypeTokens()

Related method (PHPCS 3.3.0+).

since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::parameterTypeTokens() method instead.

Return values
array<string|int, mixed>

<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<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$propertyTypeTokens property.

since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added support for PHP 8.0 identifier name tokens.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

Return values
array<string|int, mixed>

<int|string> => <int|string>

propertyTypeTokensBC()

DEPRECATED: Token types which can be encountered in a property type declaration (cross-version).

public static propertyTypeTokensBC() : array<string|int, mixed>
Tags
see
Collections::propertyTypeTokens()

Related method (PHPCS 3.3.0+).

since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::propertyTypeTokens() method instead.

Return values
array<string|int, mixed>

<int|string> => <int|string>

returnTypeTokens()

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

public static returnTypeTokens() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$returnTypeTokens property.

since
1.0.0-alpha4

Added the T_TYPE_UNION, T_FALSE, T_NULL tokens for PHP 8.0 union type support.

since
1.0.0-alpha4

Added support for PHP 8.0 identifier name tokens.

since
1.0.0-alpha4

Added the T_TYPE_INTERSECTION token for PHP 8.1 intersection type support.

since
1.0.0-alpha4

Added the T_TRUE token for PHP 8.2 true type support.

Return values
array<string|int, mixed>

<int|string> => <int|string>

returnTypeTokensBC()

DEPRECATED: Token types which can be encountered in a return type declaration (cross-version).

public static returnTypeTokensBC() : array<string|int, mixed>
Tags
see
Collections::returnTypeTokens()

Related method (PHPCS 3.3.0+).

since
1.0.0-alpha3
deprecated
1.0.0-alpha4

Use the Collections::returnTypeTokens() method instead.

Return values
array<string|int, mixed>

<int|string> => <int|string>

shortArrayListOpenTokensBC()

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

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

Return values
array<string|int, mixed>

shortArrayTokens()

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

Tokens which are used for short arrays.

Return values
array<string|int, mixed>

shortArrayTokensBC()

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

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

Return values
array<string|int, mixed>

shortListTokens()

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

Tokens which are used for short lists.

Return values
array<string|int, mixed>

shortListTokensBC()

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

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

Return values
array<string|int, mixed>

textStringStartTokens()

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

public static textStringStartTokens() : array<string|int, mixed>
Tags
since
1.0.0-alpha4

This method replaces the Collections::$textStingStartTokens property.

Return values
array<string|int, mixed>

<int|string> => <int|string>

Search results