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