xref: /PHP-8.1/Zend/tests/ns_037.phpt (revision 7aacc705)
1--TEST--
2037: Name ambiguity (namespace name or namespace's class name)
3--FILE--
4<?php
5namespace X;
6use X as Y;
7class X {
8    const C = "const ok\n";
9    static $var = "var ok\n";
10    function __construct() {
11        echo "class ok\n";
12    }
13    static function bar() {
14        echo "method ok\n";
15    }
16}
17new X();
18new Y\X();
19new \X\X();
20X::bar();
21Y\X::bar();
22\X\X::bar();
23echo X::C;
24echo Y\X::C;
25echo \X\X::C;
26echo X::$var;
27echo Y\X::$var;
28echo \X\X::$var;
29?>
30--EXPECT--
31class ok
32class ok
33class ok
34method ok
35method ok
36method ok
37const ok
38const ok
39const ok
40var ok
41var ok
42var ok
43