xref: /php-src/Zend/tests/anon_class_name.phpt (revision 72bd5590)
1--TEST--
2Generated names for anonymous classes
3--FILE--
4<?php
5
6namespace DeclaringNS {
7    class Test1 {}
8    interface Test2 {}
9    interface Test3 {}
10}
11
12namespace UsingNS {
13    function print_name(object $obj) {
14        echo strstr(get_class($obj), "\0", true), "\n";
15    }
16
17    print_name(new class {});
18    print_name(new class extends \DeclaringNS\Test1 {});
19    print_name(new class extends \DeclaringNS\Test1 implements \DeclaringNS\Test2 {});
20    print_name(new class implements \DeclaringNS\Test2 {});
21    print_name(new class implements \DeclaringNS\Test2, \DeclaringNS\Test3 {});
22}
23
24?>
25--EXPECT--
26class@anonymous
27DeclaringNS\Test1@anonymous
28DeclaringNS\Test1@anonymous
29DeclaringNS\Test2@anonymous
30DeclaringNS\Test2@anonymous
31