1
1
--TEST--
2
- GH-9470: ReflectionMethod constructor should not find private parent method
2
+ GH-9470: ReflectionMethod constructor finds private parent method
3
3
--FILE--
4
4
<?php
5
5
@@ -13,11 +13,12 @@ class B extends A {}
13
13
14
14
echo (string ) new ReflectionMethod ('B ' , 'publicMethod ' );
15
15
echo (string ) new ReflectionMethod ('B ' , 'protectedMethod ' );
16
- try {
17
- echo (string ) new ReflectionMethod ('B ' , 'privateMethod ' );
18
- } catch (Throwable $ e ){
19
- echo $ e ->getMessage (), "\n" ;
20
- }
16
+ echo (string ) new ReflectionMethod ('B ' , 'privateMethod ' );
17
+
18
+ $ r = new ReflectionClass ('B ' );
19
+ echo (string ) $ r ->getMethod ('publicMethod ' );
20
+ echo (string ) $ r ->getMethod ('protectedMethod ' );
21
+ echo (string ) $ r ->getMethod ('privateMethod ' );
21
22
22
23
?>
23
24
--EXPECTF--
@@ -27,4 +28,15 @@ Method [ <user, inherits A> public method publicMethod ] {
27
28
Method [ <user, inherits A> protected method protectedMethod ] {
28
29
@@ %s 6 - 6
29
30
}
30
- Method B::privateMethod() does not exist
31
+ Method [ <user, inherits A> private method privateMethod ] {
32
+ @@ %s 7 - 7
33
+ }
34
+ Method [ <user, inherits A> public method publicMethod ] {
35
+ @@ %s 5 - 5
36
+ }
37
+ Method [ <user, inherits A> protected method protectedMethod ] {
38
+ @@ %s 6 - 6
39
+ }
40
+ Method [ <user, inherits A> private method privateMethod ] {
41
+ @@ %s 7 - 7
42
+ }
0 commit comments