xref: /PHP-8.3/Zend/tests/lsb_021.phpt (revision ee510eed)
1--TEST--
2ZE2 Late Static Binding parent::/self:: forwarding while classname doesn't
3--FILE--
4<?php
5class A {
6    public static function test() {
7        echo get_called_class()."\n";
8    }
9}
10
11class B extends A {
12    public static function testForward() {
13        parent::test();
14        call_user_func("parent::test");
15        call_user_func(array("parent", "test"));
16        self::test();
17        call_user_func("self::test");
18        call_user_func(array("self", "test"));
19    }
20    public static function testNoForward() {
21        A::test();
22        call_user_func("A::test");
23        call_user_func(array("A", "test"));
24        B::test();
25        call_user_func("B::test");
26        call_user_func(array("B", "test"));
27
28        (self::class)::test();
29        call_user_func(self::class . "::test");
30        call_user_func(array(self::class, "test"));
31    }
32}
33
34class C extends B {
35
36}
37
38C::testForward();
39C::testNoForward();
40
41?>
42--EXPECTF--
43C
44
45Deprecated: Use of "parent" in callables is deprecated in %s on line %d
46C
47
48Deprecated: Use of "parent" in callables is deprecated in %s on line %d
49C
50C
51
52Deprecated: Use of "self" in callables is deprecated in %s on line %d
53C
54
55Deprecated: Use of "self" in callables is deprecated in %s on line %d
56C
57A
58A
59A
60B
61B
62B
63B
64B
65B
66