[DependencyInjection] Unable to dump a service container when autowiring with enum default value #48178
Labels
Bug
DependencyInjection
Help wanted
Issues and PRs which are looking for volunteers to complete them.
Status: Needs Review
Symfony version(s) affected
v6.2.0-BETA2
Description
When trying to autowire a service which contains an enum default value, the container build fails with the following error:
How to reproduce
once you change
$level = Level::Debug
to$level = 100
, the error disappear and the container build is successfulalso interesting is that removing the
bool $test = true,
also compiles without error, so it's more complex than just "enum default values do not work"Possible Solution
No response
Additional Context
I experience this issue when trying to migrate a logging handler from monolog v2 to v3, where the best practice is to express default levels with enums.
workaround is to add the default value in the arguments as well:
The text was updated successfully, but these errors were encountered: