xref: /PHP-7.4/ext/reflection/tests/bug51905.phpt (revision c4be9c38)
1--TEST--
2Bug #51905 (ReflectionParameter fails if default value is an array with an access to self::)
3--FILE--
4<?php
5
6class Bar {
7	const Y = 20;
8}
9
10class Foo extends Bar {
11	const X = 12;
12	public function x($x = 1, $y = array(self::X), $z = parent::Y) {}
13}
14
15$clazz = new ReflectionClass('Foo');
16$method = $clazz->getMethod('x');
17foreach ($method->getParameters() as $param) {
18    if ( $param->isDefaultValueAvailable())
19        echo '$', $param->getName(), ' : ', var_export($param->getDefaultValue(), 1), "\n";
20}
21
22?>
23--EXPECT--
24$x : 1
25$y : array (
26  0 => 12,
27)
28$z : 20
29