xref: /PHP-7.0/Zend/tests/ns_090.phpt (revision 22d6cc7c)
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
37--EXPECTF--
38Foo\Bar\Baz\A::__construct
39Foo\Bar\Baz\B::__construct
40Foo\Bar\Baz\C::__construct
41Foo\Bar\Baz\D::__construct
42Fiz\Biz\Buz\C::__construct
43Foo\Bar\Baz\foo
44Foo\Bar\Baz\bar
45Fiz\Biz\Buz\bar
46int(0)
47int(1)
48int(100)
49