summaryrefslogtreecommitdiff
path: root/Zend/tests/anon_class_name.phpt
blob: 36f613d707b1c69fd354464ef3191b7c30d616e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--TEST--
Generated names for anonymous classes
--FILE--
<?php

namespace DeclaringNS {
    class Test1 {}
    interface Test2 {}
    interface Test3 {}
}

namespace UsingNS {
    function print_name(object $obj) {
        echo strstr(get_class($obj), "\0", true), "\n";
    }

    print_name(new class {});
    print_name(new class extends \DeclaringNS\Test1 {});
    print_name(new class extends \DeclaringNS\Test1 implements \DeclaringNS\Test2 {});
    print_name(new class implements \DeclaringNS\Test2 {});
    print_name(new class implements \DeclaringNS\Test2, \DeclaringNS\Test3 {});
}

?>
--EXPECT--
class@anonymous
DeclaringNS\Test1@anonymous
DeclaringNS\Test1@anonymous
DeclaringNS\Test2@anonymous
DeclaringNS\Test2@anonymous