Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 3.3.10, 3.4.0-BETA1, 4.0.0-BETA1 |
Usecase | Legacy codebase, integrating Symfony DI w/o pulling in YAML |
Demo | repo |
When using Symfony DI with autoconfiguration, there is a major discrepancy between equivalent PHP and YAML configs:
If using the YAML config, you can override default options with _instanceof.
If using the PHP config, you can not override default options with registerForAutoconfiguration.
Please note, when I say 'default options', I mean the definition used for ContainerBuilder::registerClasses($definition, $path)
, as shown in the example here.
The linked project demonstrates this discrepancy by attempting to use _instanceof/registerForAutoconfiguration to make the class ConsoleApplication public.
This appears to happen with any options that are changed from the Definition default values, and can be worked around by calling $definition->setChanges([])