- token_get_all: documentation ( source)
- token_name: documentation ( source)
<?php
$attribute = <<<EOF
<?php
#[Block(
id: 'test',
label: new TranslatableMarkup('test')
)]
class A {}
EOF;
foreach (token_get_all($attribute) as $token) {
if (is_array($token)) {
print token_name($token[0]) . ' ' . $token[1] . "\n";
}
}