xref: /PHP-8.2/ext/tokenizer/tests/attributes.phpt (revision 6600ad60)
1--TEST--
2Attributes are exposed as tokens.
3--EXTENSIONS--
4tokenizer
5--FILE--
6<?php
7
8$tokens = token_get_all('<?php #[A1(1, 2)] class C1 { }');
9
10$attr = $tokens[1];
11var_dump(token_name(T_ATTRIBUTE));
12var_dump($attr[0] === T_ATTRIBUTE);
13var_dump($attr[1]);
14
15$class = $tokens[2];
16var_dump($class[1]);
17?>
18--EXPECT--
19string(11) "T_ATTRIBUTE"
20bool(true)
21string(2) "#["
22string(2) "A1"
23