xref: /PHP-8.3/ext/reflection/tests/gh9470.phpt (revision 3433dab5)
1--TEST--
2GH-9470: ReflectionMethod constructor finds private parent method
3--FILE--
4<?php
5
6class A
7{
8    public function publicMethod() {}
9    protected function protectedMethod() {}
10    private function privateMethod() {}
11}
12class B extends A {}
13
14echo (string) new ReflectionMethod('B', 'publicMethod');
15echo (string) new ReflectionMethod('B', 'protectedMethod');
16echo (string) new ReflectionMethod('B', 'privateMethod');
17
18$r = new ReflectionClass('B');
19echo (string) $r->getMethod('publicMethod');
20echo (string) $r->getMethod('protectedMethod');
21echo (string) $r->getMethod('privateMethod');
22
23?>
24--EXPECTF--
25Method [ <user, inherits A> public method publicMethod ] {
26  @@ %s 5 - 5
27}
28Method [ <user, inherits A> protected method protectedMethod ] {
29  @@ %s 6 - 6
30}
31Method [ <user, inherits A> private method privateMethod ] {
32  @@ %s 7 - 7
33}
34Method [ <user, inherits A> public method publicMethod ] {
35  @@ %s 5 - 5
36}
37Method [ <user, inherits A> protected method protectedMethod ] {
38  @@ %s 6 - 6
39}
40Method [ <user, inherits A> private method privateMethod ] {
41  @@ %s 7 - 7
42}
43