Commit 2a633cf
committed
bug symfony#49292 [VarDumper] Fix error when reflected class has default Enum parameter in constructor (kapiwko)
This PR was submitted for the 6.3 branch but it was squashed and merged into the 5.4 branch instead.
Discussion
----------
[VarDumper] Fix error when reflected class has default Enum parameter in constructor
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | no
| License | MIT
| Doc PR | no
Have classes:
```
enum GeometryType: string
{
case Geometry = 'GEOMETRY';
}
```
```
final class Geometry
{
public function __construct(GeometryType $type = GeometryType::Geometry)
{
}
}
```
Try to dump reflection of class Geometry:
```
$reflection = new \ReflectionClass(Geometry::class);
dump($reflection);
```
Have error:
`Symfony\Component\VarDumper\Caster\ConstStub::__construct(): Argument #2 ($value) must be of type string|int|float|null, App\Infrastructure\Geometry\GeometryType given, called in [...]/vendor/symfony/var-dumper/Caster/ReflectionCaster.php on line 296`
Commits
-------
d6a7730 [VarDumper] Fix error when reflected class has default Enum parameter in constructor1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
| |||
0 commit comments