xref: /PHP-8.2/Zend/tests/class_alias_020.phpt (revision d30cd7d7)
1--TEST--
2Testing class alias in multiple namespaces
3--FILE--
4<?php
5
6namespace foo;
7
8
9class foo {
10}
11
12class_alias(__NAMESPACE__ .'\foo', 'foo');
13
14namespace foo\bar;
15
16class foo {
17}
18
19class_alias(__NAMESPACE__ .'\foo', 'bar');
20
21
22var_dump(new \foo, new \bar);
23
24var_dump(new \foo\foo, new \foo\bar);
25
26?>
27--EXPECTF--
28object(foo\foo)#1 (0) {
29}
30object(foo\bar\foo)#2 (0) {
31}
32
33Fatal error: Uncaught Error: Class "foo\bar" not found in %s:%d
34Stack trace:
35#0 {main}
36  thrown in %s on line %d
37