final class Alias
Public API: explicitly declared with @visibility public.

The string alias of a token, as in %token PLUS "+" or %token END _("end of file").

Reading an aliasdoctest
$file = (new \BisonParser\Parser())->parse("%token END 0 _(\"end of file\")\n%%\ns: END;\n");
    $file->declarations[0]->entries[0]->alias?->text // => 'end of file'
    $file->declarations[0]->entries[0]->alias?->translatable // => true

Properties§

public string $text
public bool $translatable
public Location $location
public string|null $spelling = null

Methods§

public function __construct(
    public string $text,
    public bool $translatable,
    public Location $location,
    public string|null $spelling = null,
)

Parameters

$textstringThe decoded string
$translatableboolWhether the alias was written as `_("...")`
$locationLocationWhere the alias is written
$spellingstring|nullThe alias as written, quotes and escapes included; null when built by hand

Test cases 11§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 10

Relations§

Instantiated in 1
Type declarations 1