Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[DependencyInjection][Routing] Deprecate XML configuration format#60568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
2169ea4 toc5c98cbComparec5c98cb toe7849d9Comparef21defc tod725030Comparestof commentedMay 28, 2025
Let's wait on the discussion on the issue to know what should actually be deprecated. This PR deprecates a lot more than what was mentioned in the issue it fixes. |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
🚀
Some test cases need some love.
| */ | ||
| publicfunctiontestInlineServicesAreNotCandidates() | ||
| { | ||
| $this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
shouldn't we rewrite this to use another format instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This test looks like it’s XML specific:#24491
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
ded957c to55ac82eCompare703118b to8a4b6caCompare278edc5 toe01cb8eComparestof commentedOct 1, 2025
@GromNaN I discovered your scripthttps://gist.github.com/GromNaN/49ebdd48f1922a201c353145efdee9b2 in the API-Platform PR. It would be great to make it support all features for the conversion (it currently does not support |
GromNaN commentedOct 1, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
| * Add argument`$throwOnAbstract` to`ContainerBuilder::findTaggedResourceIds()` | ||
| * Deprecate registering a service without a class when its id is a non-existing FQCN | ||
| * Deprecate using`$this` or its internal scope from PHP config files; use the`$loader` variable instead | ||
| * Deprecate XML configuration format, use YAML or PHP instead |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think we must have a more elaborate UPGRADE description. People will need some guidance on how to migrate their XML config to the other formats.
Do we tell them to use the documentation (relatedsymfony/symfony-docs#21449 (comment))? Do we link any migration tool, if it's created? Let's brainstorm on how to best help the community here.
stof commentedOct 1, 2025
For reference, I opened a bunch of issues on the repo of@GromNaN to list things that are not supported yet. Contributions are welcome to make the migration tool more complete. |
…etXsdValidationBasePath()` and `getNamespace()` (nicolas-grekas)This PR was merged into the 7.4 branch.Discussion----------[DependencyInjection] Deprecate `ExtensionInterface::getXsdValidationBasePath()` and `getNamespace()`| Q | A| ------------- | ---| Branch? | 7.4| Bug fix? | no| New feature? | no| Deprecations? | yes| Issues | -| License | MITFollows the deprecation of XML config formats in#60568Bundles that need to support older versions of Symfony can keep the methods but need to add the ``@deprecated`` annotation on themCommits-------62dabe7 [DependencyInjection] Deprecate ExtensionInterface::getXsdValidationBasePath() and getNamespace()
…ML loaders are removed (nicolas-grekas)This PR was merged into the 7.4 branch.Discussion---------- Ensure branch 7.4 will remain compatible with 8.0 once XML loaders are removed| Q | A| ------------- | ---| Branch? | 7.4| Bug fix? | no| New feature? | no| Deprecations? | no| Issues | -| License | MITAfter#60568Needed for#61930Commits-------758c7f5 Ensure branch 7.4 will remain compatible with 8.0 once XML loaders are removed
…XML configuration format (nicolas-grekas)This PR was merged into the 8.0 branch.Discussion----------[DependencyInjection][Routing] Remove support for the XML configuration format| Q | A| ------------- | ---| Branch? | 8.0| Bug fix? | no| New feature? | yes| Deprecations? | no| Issues | -| License | MITPer#60568Commits-------af1f030 [DependencyInjection][Routing] Remove support for the XML configuration format
This PR was squashed before being merged into the 3.x branch.Discussion----------Mark XML configuration tests as legacy| Q | A| ------------- | ---| Branch? | 3.x| Bug fix? | no (test only)| New feature? | no| Deprecations? | no (deprecated by Symfony itself)| Issues | Related tosymfony/symfony#60568| License | MITHide deprecation notices on Symfony 7.4 without asserting the deprecation message:``` 13x: Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead. 1x in XmlMonologExtensionTest::testLoadWithSeveralHandlers from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testLoadWithOverwriting from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testLoadWithNewAtEnd from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testLoadWithNewAndPriority from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testHandlersWithChannels from Symfony\Bundle\MonologBundle\Tests\DependencyInjection ...Remaining indirect deprecation notices (3) 3x: Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead. 1x in XmlMonologExtensionTest::testLoadWithOverwriting from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testLoadWithNewAtEnd from Symfony\Bundle\MonologBundle\Tests\DependencyInjection 1x in XmlMonologExtensionTest::testLoadWithNewAndPriority from Symfony\Bundle\MonologBundle\Tests\DependencyInjection```Commits-------78b5730 Mark XML configuration tests as legacy
This PR was merged into the 4.x branch.Discussion----------Skip XML config tests with Symfony 8.0| Q | A| ------------- | ---| Branch? | 4.x| Bug fix? | no| New feature? | no| Deprecations? | no| Issues | Related tosymfony/symfony#60568| License | MITFollow-up:-#541As soon as we keep support for Symfony 7.4, we must keep the tests on XML config format.Commits-------3d3b625 Skip XML config tests with Symfony 8.0
## DescriptionMigrates xml to php config to fix deprecation in Symfony 7.4symfony/symfony#60568Closes#2558## What type of PR is this? (check all applicable)- [ ] Bug Fix- [ ] Feature- [ ] Refactor- [x] Deprecation- [ ] Breaking Change- [ ] Documentation Update- [ ] CI## Checklist- [ ] I have made corresponding changes to the documentation (`docs/`)- [ ] I have made corresponding changes to the changelog(`CHANGELOG.md`)---------Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… format for semantic configuration (nicolas-grekas)This PR was merged into the 7.4 branch.Discussion----------[Config][DependencyInjection] Deprecate the fluent PHP format for semantic configuration| Q | A| ------------- | ---| Branch? | 7.4| Bug fix? | no| New feature? | yes| Deprecations? | no| Issues | -| License | MITThis PR deprecates the fluent PHP format for semantic configuration introduced in Symfony 5.4 by `@Nyholm` (see#40600).It aims to replace it with the new array-based PHP config format (see#61490).The fluent PHP config format was a great experiment:- It helped us improve the Config component and the code generation of fluent config builders.- It confirmed the community’s interest in PHP-based configuration.- And it showed us its limits.Those limits are structural. Writing fluent config is difficult and full of edge cases. Its rigidity comes from having to match one canonical interpretation of the semantic config tree. Automatic code generation can’t capture the custom logic that before-normalizers introduce, yet those normalizers are essential for flexibility and backward compatibility. This rigidity makes fluent config fragile. How do we deal with this fragility as config tree authors? At the moment, we don't care. Maybe this format is too niche for you to have experienced this issue, but we cannot guarantee that simple upgrades won't break your fluent PHP config.The new array-based PHP format builds directly on the same code used for loading YAML configs.That means:- trivial conversion between YAML and PHP arrays,- identical flexibility and behavior,- and support for auto-completion and static analysis through generated array shapes.The generated array shapes are rigid too, but that rigidity is non-breaking: even if your config no longer matches the canonical shape, your app keeps working. Static analyzers might warn you: that’s an invitation to update, not a failure.I'm submitting this PR a bit l late for 7.4 but I think it's important to merge now. Deprecating the fluent PHP config format will:- prevent new code from relying on a fragile approach,- make room in the documentation for the array-based format,- and consolidate Symfony’s configuration story around a robust PHP-based format.Fluent PHP for semantic config served us well but it's time to retire it. ```diff -return function (AcmeConfig $config) { - $config->color('red'); -} +return new AcmeConfig([ + 'color' => 'red', +]); ```PS: there's another fluent config format for services and routes (see#23834 and#24180). This other format is handwritten. It doesn't have the issues listed above and it is *not* deprecated. It's actually the recommended way *for bundles* to declare their config (instead of XML, see#60568).Commits-------332b4ac [Config][DependencyInjection] Deprecate the fluent PHP format for semantic configuration
Uh oh!
There was an error while loading.Please reload this page.
From#60560 (comment)