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
}

src/Symfony/Component/Serializer/Tests/Mapping/Loader/XmlFileLoaderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
/**
3333
* @author Kévin Dunglas <dunglas@gmail.com>
34+
*
35+
* @group legacy
3436
*/
3537
class XmlFileLoaderTest extends TestCase
3638
{

src/Symfony/Component/Validator/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/Validator/Mapping/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Loads validation metadata from an XML file.
2121
*
2222
* @author Bernhard Schussek <bschussek@gmail.com>
23+
*
24+
* @deprecated since Symfony 7.4, use another loader instead
2325
*/
2426
class XmlFileLoader extends FileLoader
2527
{
@@ -37,6 +39,8 @@ public function __construct(string $file)
3739

3840
public function loadClassMetadata(ClassMetadata $metadata): bool
3941
{
42+
trigger_deprecation('symfony/validator', '7.4', 'XML configuration format is deprecated, use YAML or attributes instead.');
43+
4044
if (!isset($this->classes)) {
4145
$this->loadClassesFromXml();
4246
}

src/Symfony/Component/Validator/Mapping/Loader/XmlFilesLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@
1111

1212
namespace Symfony\Component\Validator\Mapping\Loader;
1313

14+
trigger_deprecation('symfony/validator', '7.4', 'XML configuration format is deprecated, use YAML or attributes instead.');
15+
1416
/**
1517
* Loads validation metadata from a list of XML files.
1618
*
1719
* @author Bulat Shakirzyanov <mallluhuct@gmail.com>
1820
* @author Bernhard Schussek <bschussek@gmail.com>
1921
*
2022
* @see FilesLoader
23+
*
24+
* @deprecated since Symfony 7.4, use another loader instead
2125
*/
2226
class XmlFilesLoader extends FilesLoader
2327
{

src/Symfony/Component/Validator/Tests/Mapping/Loader/XmlFileLoaderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
use Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures\ConstraintWithNamedArguments;
3838
use Symfony\Component\Validator\Tests\Mapping\Loader\Fixtures\ConstraintWithoutValueWithNamedArguments;
3939

40+
/**
41+
* @group legacy
42+
*/
4043
class XmlFileLoaderTest extends TestCase
4144
{
4245
use ExpectUserDeprecationMessageTrait;

0 commit comments

Comments
 (0)