classUnionDeclaration
final class UnionDeclaration
implements Declaration
Public API: explicitly declared with
@visibility public.A %union directive, its optional name, and its members.
$file = (new \BisonParser\Parser())->parse("%union YYSTYPE { int i; char *s; }\n%%\ns: 'a';\n");
$file->declarations[0]->name // => 'YYSTYPE'
$file->declarations[0]->code // => ' int i; char *s; 'Properties§
public string|null $namepublic string $codepublic Location $locationMethods§
public function __construct(
public string|null $name,
public string $code,
public Location $location,
)Parameters
$name | string|null | The union's name, or null when none is given |
$code | string | The members without the braces |
$location | Location | Where the directive is written |
Test cases 7§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.