xref: /PHP-8.0/ext/tokenizer/tests/bug77966.phpt (revision b1019f46)
1--TEST--
2Handling of "namespace as" in TOKEN_PARSE mode
3--FILE--
4<?php
5
6$code = <<<'CODE'
7<?php
8class C {
9    use A {
10        namespace as bar;
11    }
12}
13CODE;
14
15$tokens = PhpToken::tokenize($code, TOKEN_PARSE);
16foreach ($tokens as $token) {
17    echo "{$token->getTokenName()}: \"$token->text\"\n";
18}
19
20?>
21--EXPECT--
22T_OPEN_TAG: "<?php
23"
24T_CLASS: "class"
25T_WHITESPACE: " "
26T_STRING: "C"
27T_WHITESPACE: " "
28{: "{"
29T_WHITESPACE: "
30    "
31T_USE: "use"
32T_WHITESPACE: " "
33T_STRING: "A"
34T_WHITESPACE: " "
35{: "{"
36T_WHITESPACE: "
37        "
38T_STRING: "namespace"
39T_WHITESPACE: " "
40T_AS: "as"
41T_WHITESPACE: " "
42T_STRING: "bar"
43;: ";"
44T_WHITESPACE: "
45    "
46}: "}"
47T_WHITESPACE: "
48"
49}: "}"
50