Skip to content

[DependencyInjection][Routing][Serializer][Validator] 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

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

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

@@ -32,6 +33,8 @@

class XmlDumperTest extends TestCase
Copy link
Member

@nicolas-grekas nicolas-grekas May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

side question: do we want to keep the xml dumper?
it's used by some external tools AFAIK, so likely yes

Copy link
Contributor Author

@MatTheCat MatTheCat May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have commands loading such XML dumps, like debug:container. Not sure what we should do about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR I gave a try on other formats: PHP dumper cannot dump a non-compiled container, and YAML dumper suffers from #60573

public function testImportWithGlobPattern()
{
$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.

maybe remove/spli the xml part? a legacy test case is usually planned for removal, which isn't the case for this one, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed we could simply remove the XML part from the test on 8.0 but after a second look it seems it would be better to replace the XML config with a PHP one in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -116,8 +116,13 @@ public function testLoadParameters()
$this->assertEquals(['foo' => 'bar', 'mixedcase' => ['MixedCaseKey' => 'value'], 'values' => [true, false, 0, 1000.3, \PHP_INT_MAX], 'bar' => 'foo', 'escape' => '@escapeme', 'foo_bar' => new Reference('foo_bar')], $container->getParameterBag()->all(), '->load() converts YAML keys to lowercase');
}

/**
* @group legacy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same concern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed as well

DependencyInjection
-------------------

* Deprecate XML configuration format, use YAML or PHP instead
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genuine question; wdyt documenting PHP before YAML?
seeing more and more config file written in PHP lately as the ecosystem and tooling evolve
(symfony core included)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yaml is still the best way to go in combination with flex/recipes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we’re going to order the alternatives, is it correct for the other components’?

@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch from d725030 to d1a9099 Compare May 28, 2025 16:48
@MatTheCat MatTheCat force-pushed the deprecate-xml-loaders branch from d1a9099 to ded957c Compare May 28, 2025 17:04
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
5 participants