Skip to content

Commit 4c83abd

Browse files
committed
[DependencyInjection][Routing] Deprecate XML configuration format
1 parent 0498566 commit 4c83abd

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CHANGELOG
1212
* Deprecate class aliases in the `Annotation` namespace, use attributes instead
1313
* Deprecate getters and setters in attribute classes in favor of public properties
1414
* Deprecate accessing the internal scope of the loader in PHP config files, use only its public API instead
15+
* Deprecate XML configuration format, use YAML, PHP or attributes instead
1516

1617
7.3
1718
---

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);

Tests/Loader/XmlFileLoaderTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Component\Routing\Tests\Loader;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15+
use PHPUnit\Framework\Attributes\Group;
16+
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1517
use PHPUnit\Framework\TestCase;
1618
use Symfony\Component\Config\FileLocator;
1719
use Symfony\Component\Config\Loader\LoaderResolver;
@@ -24,6 +26,8 @@
2426
use Symfony\Component\Routing\Tests\Fixtures\CustomXmlFileLoader;
2527
use Symfony\Component\Routing\Tests\Fixtures\Psr4Controllers\MyController;
2628

29+
#[IgnoreDeprecations]
30+
#[Group('legacy')]
2731
class XmlFileLoaderTest extends TestCase
2832
{
2933
public function testSupports()

0 commit comments

Comments
 (0)