xref: /PHP-7.1/Zend/tests/ns_090.phpt (revision 113213f0)
1--TEST--
2Group use statements declared inline
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\{ A, B, C as AC, D };
18    use Foo\Bar\Baz\{ function foo, function bar as buz, const FOO, const BAR AS BOZ };
19
20    class C { function __construct() {echo __METHOD__,"\n";}}
21    function bar(){echo __FUNCTION__,"\n";}
22    const BAR = 100;
23
24    new A;
25    new B;
26    new AC;
27    new D;
28    new C;
29    foo();
30    buz();
31    bar();
32    var_dump(FOO);
33    var_dump(BOZ);
34    var_dump(BAR);
35}
36--EXPECTF--
37Foo\Bar\Baz\A::__construct
38Foo\Bar\Baz\B::__construct
39Foo\Bar\Baz\C::__construct
40Foo\Bar\Baz\D::__construct
41Fiz\Biz\Buz\C::__construct
42Foo\Bar\Baz\foo
43Foo\Bar\Baz\bar
44Fiz\Biz\Buz\bar
45int(0)
46int(1)
47int(100)
48