Skip to content

Commit 2169ea4

Browse files
committed
Deprecate XML configuration format
1 parent 298e56a commit 2169ea4

File tree

15 files changed

+88
-3
lines changed

15 files changed

+88
-3
lines changed

UPGRADE-7.4.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
UPGRADE FROM 7.3 to 7.4
2+
=======================
3+
4+
Symfony 7.4 is a minor release. According to the Symfony release process, there should be no significant
5+
backward compatibility breaks. Minor backward compatibility breaks are prefixed in this document with
6+
`[BC BREAK]`, make sure your code is compatible with these entries before upgrading.
7+
Read more about this in the [Symfony documentation](https://symfony.com/doc/7.4/setup/upgrade_minor.html).
8+
9+
If you're upgrading from a version below 7.3, follow the [7.3 upgrade guide](UPGRADE-7.3.md) first.
10+
11+
DependencyInjection
12+
-------------------
13+
14+
* Deprecate XML configuration format, use YAML or PHP instead
15+
16+
Routing
17+
-------
18+
19+
* Deprecate XML configuration format, use YAML, PHP or attributes instead
20+
21+
Serializer
22+
----------
23+
24+
* Deprecate XML configuration format, use YAML or attributes instead
25+
26+
Validator
27+
---------
28+
29+
* Deprecate XML configuration format, use YAML or attributes instead

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.4
5+
---
6+
7+
* Deprecate XML configuration format, use YAML or PHP instead
8+
49
7.3
510
---
611

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
* XmlFileLoader loads XML files service definitions.
3535
*
3636
* @author Fabien Potencier <fabien@symfony.com>
37+
*
38+
* @deprecated since Symfony 7.4, use another loader instead
3739
*/
3840
class XmlFileLoader extends FileLoader
3941
{
@@ -43,6 +45,8 @@ class XmlFileLoader extends FileLoader
4345

4446
public function load(mixed $resource, ?string $type = null): mixed
4547
{
48+
trigger_deprecation('symfony/dependency-injection', '7.4', 'XML configuration format is deprecated, use YAML or PHP instead.');
49+
4650
$path = $this->locator->locate($resource);
4751

4852
$xml = $this->parseFileToDOM($path);

src/Symfony/Component/DependencyInjection/Tests/Compiler/AutowirePassTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Psr\Log\LoggerInterface;
1616
use Psr\Log\NullLogger;
1717
use Symfony\Bridge\PhpUnit\ClassExistsMock;
18+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1819
use Symfony\Component\Config\FileLocator;
1920
use Symfony\Component\Config\Resource\ClassExistenceResource;
2021
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
@@ -44,6 +45,8 @@
4445

4546
class AutowirePassTest extends TestCase
4647
{
48+
use ExpectUserDeprecationMessageTrait;
49+
4750
public static function setUpBeforeClass(): void
4851
{
4952
ClassExistsMock::register(AutowirePass::class);
@@ -989,8 +992,13 @@ public function testExceptionWhenAliasDoesNotExist()
989992
}
990993
}
991994

995+
/**
996+
* @group legacy
997+
*/
992998
public function testInlineServicesAreNotCandidates()
993999
{
1000+
$this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead.');
1001+
9941002
$container = new ContainerBuilder();
9951003
$loader = new XmlFileLoader($container, new FileLocator(realpath(__DIR__.'/../Fixtures/xml')));
9961004
$loader->load('services_inline_not_candidate.xml');

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
use Symfony\Component\DependencyInjection\Tests\Fixtures\RemoteCallerSocket;
5151
use Symfony\Component\ExpressionLanguage\Expression;
5252

53+
/**
54+
* @group legacy
55+
*/
5356
class XmlFileLoaderTest extends TestCase
5457
{
5558
use ExpectUserDeprecationMessageTrait;
@@ -1335,9 +1338,6 @@ public function testUnknownConstantAsKey()
13351338
$loader->load('key_type_wrong_constant.xml');
13361339
}
13371340

1338-
/**
1339-
* @group legacy
1340-
*/
13411341
public function testDeprecatedTagged()
13421342
{
13431343
$container = new ContainerBuilder();

src/Symfony/Component/Routing/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.4
5+
---
6+
7+
* Deprecate XML configuration format, use YAML, PHP or attributes instead
8+
49
7.3
510
---
611

src/Symfony/Component/Routing/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
*
2525
* @author Fabien Potencier <fabien@symfony.com>
2626
* @author Tobias Schultze <http://tobion.de>
27+
*
28+
* @deprecated since Symfony 7.4, use another loader instead
2729
*/
2830
class XmlFileLoader extends FileLoader
2931
{
@@ -40,6 +42,8 @@ class XmlFileLoader extends FileLoader
4042
*/
4143
public function load(mixed $file, ?string $type = null): RouteCollection
4244
{
45+
trigger_deprecation('symfony/routing', '7.4', 'XML configuration format is deprecated, use YAML, PHP or attributes instead.');
46+
4347
$path = $this->locator->locate($file);
4448

4549
$xml = $this->loadFile($path);

src/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
2424
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\MyController;
2525

26+
/**
27+
* @group legacy
28+
*/
2629
class XmlFileLoaderTest extends TestCase
2730
{
2831
public function testSupports()

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.4
5+
---
6+
7+
* Deprecate XML configuration format, use YAML or attributes instead
8+
49
7.3
510
---
611

src/Symfony/Component/Serializer/Mapping/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
* Loads XML mapping files.
2424
*
2525
* @author Kévin Dunglas <dunglas@gmail.com>
26+
*
27+
* @deprecated since Symfony 7.4, use another loader instead
2628
*/
2729
class XmlFileLoader extends FileLoader
2830
{
@@ -35,6 +37,8 @@ class XmlFileLoader extends FileLoader
3537

3638
public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
3739
{
40+
trigger_deprecation('symfony/serializer', '7.4', 'XML configuration format is deprecated, use YAML or attributes instead.');
41+
3842
if (!$this->classes ??= $this->getClassesFromXml()) {
3943
return false;
4044
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy