xref: /PHP-8.0/Zend/tests/ns_089.phpt (revision 7aacc705)
1--TEST--
2Group use statements
3--FILE--
4<?php
5namespace Foo\Bar\Baz {
6    function foo(){echo __FUNCTION__,"\n";}
7    function bar(){echo __FUNCTION__,"\n";}
8    const FOO = 0;
9    const BAR = 1;
10    class A { function __construct() {echo __METHOD__,"\n";} }
11    class B { function __construct() {echo __METHOD__,"\n";} }
12    class C { function __construct() {echo __METHOD__,"\n";} }
13    class D { function __construct() {echo __METHOD__,"\n";} }
14}
15namespace Fiz\Biz\Buz {
16
17    use Foo\Bar\Baz\{
18        A,
19        B,
20        C as AC,
21        D,
22        // comment between declarations
23        function foo,
24        function bar as buz,
25        const FOO,
26        const BAR AS BOZ
27    };
28
29    class C { function __construct() {echo __METHOD__,"\n";}}
30    function bar(){echo __FUNCTION__,"\n";}
31    const BAR = 100;
32
33    new A;
34    new B;
35    new AC;
36    new D;
37    new C;
38    foo();
39    buz();
40    bar();
41    var_dump(FOO);
42    var_dump(BOZ);
43    var_dump(BAR);
44}
45?>
46--EXPECT--
47Foo\Bar\Baz\A::__construct
48Foo\Bar\Baz\B::__construct
49Foo\Bar\Baz\C::__construct
50Foo\Bar\Baz\D::__construct
51Fiz\Biz\Buz\C::__construct
52Foo\Bar\Baz\foo
53Foo\Bar\Baz\bar
54Fiz\Biz\Buz\bar
55int(0)
56int(1)
57int(100)
58