Skip to content

Conversation

@MatTheCat
Copy link
Contributor

@MatTheCat MatTheCat commented May 28, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? yes
Issues Fix #60200
License MIT

From #60560 (comment)

@MatTheCat MatTheCat requested a review from dunglas as a code owner May 28, 2025 07:16
@carsonbot carsonbot added this to the 7.4 milestone May 28, 2025
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch 2 times, most recently from 2169ea4 to c5c98cb Compare May 28, 2025 09:06
@MatTheCat MatTheCat requested a review from yceruto as a code owner May 28, 2025 09:06
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch from c5c98cb to e7849d9 Compare May 28, 2025 10:04
@MatTheCat MatTheCat requested a review from chalasr as a code owner May 28, 2025 10:04
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch 2 times, most recently from f21defc to d725030 Compare May 28, 2025 10:27
@stof
Copy link
Member

stof commented May 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.

@carsonbot carsonbot changed the title Deprecate XML configuration format [DependencyInjection][Routing][Serializer][Validator] Deprecate XML configuration format May 28, 2025
Copy link
Member

@nicolas-grekas nicolas-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.

*/
public function testInlineServicesAreNotCandidates()
{
$this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, 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.

shouldn't we rewrite this to use another format instead?

Copy link
Contributor Author

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

@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch 3 times, most recently from ded957c to 55ac82e Compare May 30, 2025 10:02
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch 2 times, most recently from 703118b to 8a4b6ca Compare June 5, 2025 08:40
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch 3 times, most recently from 278edc5 to e01cb8e Compare June 17, 2025 13:31
fabpot added a commit that referenced this pull request Oct 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       | MIT

Per #60568

Commits
-------

af1f030 [DependencyInjection][Routing] Remove support for the XML configuration format
GromNaN added a commit to symfony/monolog-bundle that referenced this pull request Oct 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 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
GromNaN added a commit to symfony/monolog-bundle that referenced this pull request Oct 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 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
DjordyKoert added a commit to nelmio/NelmioApiDocBundle that referenced this pull request Oct 17, 2025
## 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 <[email protected]>
nicolas-grekas added a commit that referenced this pull request Oct 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       | 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
This was referenced Oct 27, 2025
mpdude added a commit to webfactory/WebfactoryWfdMetaBundle that referenced this pull request Nov 24, 2025
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.
mpdude added a commit to webfactory/piwik-bundle that referenced this pull request Nov 24, 2025
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.
mpdude added a commit to webfactory/WebfactoryShortcodeBundle that referenced this pull request Nov 24, 2025
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)
mpdude added a commit to webfactory/BGObjectRoutingBundle that referenced this pull request Nov 25, 2025
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.
mpdude added a commit to webfactory/WebfactoryHttpCacheBundle that referenced this pull request Nov 29, 2025
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)
mpdude added a commit to webfactory/WebfactoryHttpCacheBundle that referenced this pull request Nov 29, 2025
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Deprecate and remove support for semantic XML configuration