Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Merged
fabpot merged 1 commit intosymfony:7.4fromMatTheCat:deprecate-xml-loaders
Oct 1, 2025

Conversation

@MatTheCat
Copy link
Contributor

@MatTheCatMatTheCat commentedMay 28, 2025
edited
Loading

QA
Branch?7.4
Bug fix?no
New feature?no
Deprecations?yes
IssuesFix#60200
LicenseMIT

From#60560 (comment)

GromNaN and TomasVotruba reacted with thumbs up emoji
@carsonbotcarsonbot added this to the7.4 milestoneMay 28, 2025
@MatTheCatMatTheCatforce-pushed thedeprecate-xml-loaders branch 2 times, most recently from2169ea4 toc5c98cbCompareMay 28, 2025 09:06
@MatTheCatMatTheCatforce-pushed thedeprecate-xml-loaders branch fromc5c98cb toe7849d9CompareMay 28, 2025 10:04
@MatTheCatMatTheCatforce-pushed thedeprecate-xml-loaders branch 2 times, most recently fromf21defc tod725030CompareMay 28, 2025 10:27
@stof
Copy link
Member

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.

@carsonbotcarsonbot changed the titleDeprecate XML configuration format[DependencyInjection][Routing][Serializer][Validator] Deprecate XML configuration formatMay 28, 2025
Copy link
Member

@nicolas-grekasnicolas-grekas left a 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.');

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?

Copy link
ContributorAuthor

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

@stof
Copy link
Member

stof 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 supporttype="constant", and it does not even fail for types it does not support, silently treating them the same than the default type).
It would be great to publish it in a way allowing contributions (so in a github repo rather than a gist), to allow others to suggest improvements. Then, we could recommend that script as part of the upgrade path for the ecosystem.

@GromNaN
Copy link
Member

GromNaN commentedOct 1, 2025
edited
Loading

* 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
Copy link
Member

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
Copy link
Member

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.

nicolas-grekas added a commit that referenced this pull requestOct 2, 2025
…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()
nicolas-grekas added a commit that referenced this pull requestOct 2, 2025
…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
fabpot added a commit that referenced this pull requestOct 3, 2025
…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
GromNaN added a commit to symfony/monolog-bundle that referenced this pull requestOct 3, 2025
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
GromNaN added a commit to symfony/monolog-bundle that referenced this pull requestOct 3, 2025
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
DjordyKoert added a commit to nelmio/NelmioApiDocBundle that referenced this pull requestOct 17, 2025
## 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>
nicolas-grekas added a commit that referenced this pull requestOct 20, 2025
… 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
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wouterjwouterjwouterj left review comments

@mtarldmtarldmtarld left review comments

@fabpotfabpotfabpot approved these changes

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

@GromNaNGromNaNGromNaN approved these changes

@dunglasdunglasAwaiting requested review from dunglas

@ycerutoycerutoAwaiting requested review from ycerutoyceruto is a code owner

@chalasrchalasrAwaiting requested review from chalasrchalasr is a code owner

+1 more reviewer

@94noni94noni94noni left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

[RFC] Deprecate and remove support for semantic XML configuration

13 participants

@MatTheCat@stof@xabbuh@nicolas-grekas@mbabker@derrabus@wouterj@GromNaN@fabpot@alcaeus@94noni@mtarld@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp