8000 bug #60288 [VarExporter] dump default value for property hooks if pre… · symfony/symfony@b5b27a8 · GitHub
[go: up one dir, main page]

Skip to content

Commit b5b27a8

Browse files
committed
bug #60288 [VarExporter] dump default value for property hooks if present (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [VarExporter] dump default value for property hooks if present | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT The test added in #60258 reveals that we have another bug in our lazy ghost generation logic which leads to an error at runtime when a hook tries to read the property's default value. Commits ------- e819dab dump default value for property hooks if present
2 parents b59a25a + e819dab commit b5b27a8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Symfony/Component/VarExporter/ProxyHelper.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public static function generateLazyGhost(\ReflectionClass $class): string
7979
$hooks .= "\n "
8080
.($p->isProtected() ? 'protected' : 'public')
8181
.($p->isProtectedSet() ? ' protected(set)' : '')
82-
." {$type} \${$name} {\n";
82+
." {$type} \${$name}"
83+
.($p->hasDefaultValue() ? ' = '.$p->getDefaultValue() : '')
84+
." {\n";
8385

8486
foreach ($p->getHooks() as $hook => $method) {
8587
if ('get' === $hook) {

0 commit comments

Comments
 (0)
0