W3cubDocs

/Symfony 4.1

Token

class Token

Represents a Token.

Constants

EOF_TYPE
NAME_TYPE
NUMBER_TYPE
STRING_TYPE
OPERATOR_TYPE
PUNCTUATION_TYPE

Properties

$value
$type
$cursor

Methods

__construct(string $type, string|int|float|null $value, int|null $cursor)
string __toString()

Returns a string representation of the token.

bool test(array|int $type, string|null $value = null)

Tests the current token for a type and/or a value.

Details

__construct(string $type, string|int|float|null $value, int|null $cursor)

Parameters

string $type The type of the token (self::*_TYPE)
string|int|float|null $value The token value
int|null $cursor The cursor position in the source

string __toString()

Returns a string representation of the token.

Return Value

string A string representation of the token

bool test(array|int $type, string|null $value = null)

Tests the current token for a type and/or a value.

Parameters

array|int $type The type to test
string|null $value The token value

Return Value

bool

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/ExpressionLanguage/Token.html