xref: /PHP-7.1/Zend/tests/ns_089.phpt (revision 113213f0)
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--EXPECTF--
46Foo\Bar\Baz\A::__construct
47Foo\Bar\Baz\B::__construct
48Foo\Bar\Baz\C::__construct
49Foo\Bar\Baz\D::__construct
50Fiz\Biz\Buz\C::__construct
51Foo\Bar\Baz\foo
52Foo\Bar\Baz\bar
53Fiz\Biz\Buz\bar
54int(0)
55int(1)
56int(100)
57