-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2169ea4 to
c5c98cb
Compare
c5c98cb to
e7849d9
Compare
f21defc to
d725030
Compare
|
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.
| */ | ||
| public function testInlineServicesAreNotCandidates() | ||
| { | ||
| $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
src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Loader/FileLoaderTest.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php
Outdated
Show resolved
Hide resolved
ded957c to
55ac82e
Compare
703118b to
8a4b6ca
Compare
278edc5 to
e01cb8e
Compare
…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 | MIT Per #60568 Commits ------- 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 to symfony/symfony#60568 | License | MIT Hide 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 to symfony/symfony#60568 | License | MIT Follow-up: - #541 As 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
## Description Migrates xml to php config to fix deprecation in Symfony 7.4 symfony/symfony#60568 Closes #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 | MIT This 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
XML-basierte Service-Konfiguration ist deprecated seit symfony/symfony#60568 und wird in Symfony 8.0 nicht mehr unterstützt. Vgl. auch https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration.
XML-based service configuration has been deprecated since symfony/symfony#60568 and will no longer be supported in Symfony 8.0. See also https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration.
XML-based service configuration has been deprecated since symfony/symfony#60568 and will no longer be supported in Symfony 8.0. See also https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration. In order for ComposerRequireChecker to recognise where the functions come from, we have to import them explicitly. At the same time, PHP-CS-Fixer must not remove the import, which is actually superfluous. X-Ref GromNaN/symfony-config-xml-to-php#29, maglnet/ComposerRequireChecker#193 (comment)
XML-based service configuration has been deprecated since symfony/symfony#60568 and will no longer be supported in Symfony 8.0. See also https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration.
XML-based service configuration has been deprecated since symfony/symfony#60568 and will no longer be supported in Symfony 8.0. See also https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration. In order for ComposerRequireChecker to recognise where the functions come from, we have to import them explicitly. At the same time, PHP-CS-Fixer must not remove the import, which is actually superfluous. X-Ref GromNaN/symfony-config-xml-to-php#29, maglnet/ComposerRequireChecker#193 (comment)
XML-based service configuration has been deprecated since symfony/symfony#60568 and will no longer be supported in Symfony 8.0. See also https://symfony.com/blog/new-in-symfony-7-4-deprecated-xml-configuration. In order for ComposerRequireChecker to recognise where the functions come from, we have to import them explicitly. At the same time, PHP-CS-Fixer must not remove the import, which is actually superfluous. X-Ref GromNaN/symfony-config-xml-to-php#29, maglnet/ComposerRequireChecker#193 (comment)
From #60560 (comment)