bug #41767 [Config] fix tracking default values that reference the parent class (nicolas-grekas)
This PR was merged into the 4.4 branch.
Discussion
----------
[Config] fix tracking default values that reference the parent class
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #41133
| License | MIT
| Doc PR | -
Commits
-------
978747e6ea
[Config] fix tracking default values that reference the parent class
This commit is contained in:
commit
79a87cb64c
@ -161,6 +161,8 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
}
|
||||
}
|
||||
|
||||
$defined = \Closure::bind(static function ($c) { return \defined($c); }, null, $class->name);
|
||||
|
||||
foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) {
|
||||
if (\PHP_VERSION_ID >= 80000) {
|
||||
foreach ($m->getAttributes() as $a) {
|
||||
@ -187,7 +189,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$p->isDefaultValueConstant() || \defined($p->getDefaultValueConstantName())) {
|
||||
if (!$p->isDefaultValueConstant() || $defined($p->getDefaultValueConstantName())) {
|
||||
$defaults[$p->name] = $p->getDefaultValue();
|
||||
|
||||
continue;
|
||||
|
@ -164,6 +164,7 @@ EOPHP;
|
||||
|
||||
yield [true, 17, 'public function ccc($bar = 187) {}'];
|
||||
yield [true, 17, 'public function ccc($bar = ANOTHER_ONE_THAT_WILL_NEVER_BE_DEFINED_CCCCCCCCC) {}'];
|
||||
yield [true, 17, 'public function ccc($bar = parent::BOOM) {}'];
|
||||
yield [true, 17, null, static function () { \define('A_CONSTANT_THAT_FOR_SURE_WILL_NEVER_BE_DEFINED_CCCCCC', 'foo'); }];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user