Skip to content

Commit 13bc5de

Browse files
committed
Deprecate XML configuration format
1 parent 3685cdb commit 13bc5de

File tree

34 files changed

+442
-90
lines changed

34 files changed

+442
-90
lines changed

UPGRADE-7.4.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Console
1313

1414
* Deprecate `Symfony\Component\Console\Application::add()` in favor of `Symfony\Component\Console\Application::addCommand()`
1515

16+
DependencyInjection
17+
-------------------
18+
19+
* Deprecate XML configuration format, use YAML or PHP instead
20+
1621
FrameworkBundle
1722
---------------
1823

@@ -28,9 +33,24 @@ HttpFoundation
2833

2934
* Deprecate using `Request::sendHeaders()` after headers have already been sent; use a `StreamedResponse` instead
3035

36+
Routing
37+
-------
38+
39+
* Deprecate XML configuration format, use YAML, PHP or attributes instead
40+
3141
Security
3242
--------
3343

3444
* Deprecate callable firewall listeners, extend `AbstractListener` or implement `FirewallListenerInterface` instead
3545
* Deprecate `AbstractListener::__invoke`
3646
* Deprecate `LazyFirewallContext::__invoke()`
47+
48+
Serializer
49+
----------
50+
51+
* Deprecate XML configuration format, use YAML or attributes instead
52+
53+
Validator
54+
---------
55+
56+
* Deprecate XML configuration format, use YAML or attributes instead

src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Bridge\Doctrine\Tests\Fixtures\DoctrineLoaderParentEntity;
2323
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
2424
use Symfony\Bridge\Doctrine\Validator\DoctrineLoader;
25+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
2526
use Symfony\Component\Validator\Constraints\Length;
2627
use Symfony\Component\Validator\Mapping\AutoMappingStrategy;
2728
use Symfony\Component\Validator\Mapping\CascadingStrategy;
@@ -36,6 +37,8 @@
3637
*/
3738
class DoctrineLoaderTest extends TestCase
3839
{
40+
use ExpectUserDeprecationMessageTrait;
41+
3942
public function testLoadClassMetadata()
4043
{
4144
$validator = Validation::createValidatorBuilder()
@@ -155,8 +158,13 @@ public function testExtractEnum()
155158
$this->assertCount(0, $enumStringMetadata); // asserts the length constraint is not added to an enum
156159
}
157160

161+
/**
162+
* @group legacy
163+
*/
158164
public function testFieldMappingsConfiguration()
159165
{
166+
$this->expectUserDeprecationMessage('Since symfony/validator 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
167+
160168
$validator = Validation::createValidatorBuilder()
161169
->enableAttributeMapping()
162170
->addXmlMappings([__DIR__.'/../Resources/validator/BaseUser.xml'])

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/SerializerCacheWarmerTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
1313

14+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1415
use Symfony\Bundle\FrameworkBundle\CacheWarmer\SerializerCacheWarmer;
1516
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1617
use Symfony\Component\Cache\Adapter\NullAdapter;
@@ -21,11 +22,17 @@
2122

2223
class SerializerCacheWarmerTest extends TestCase
2324
{
25+
use ExpectUserDeprecationMessageTrait;
26+
2427
/**
28+
* @group legacy
29+
*
2530
* @dataProvider loaderProvider
2631
*/
2732
public function testWarmUp(array $loaders)
2833
{
34+
$this->expectUserDeprecationMessage('Since symfony/serializer 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
35+
2936
$file = sys_get_temp_dir().'/cache-serializer.php';
3037
@unlink($file);
3138

@@ -41,10 +48,14 @@ public function testWarmUp(array $loaders)
4148
}
4249

4350
/**
51+
* @group legacy
52+
*
4453
* @dataProvider loaderProvider
4554
*/
4655
public function testWarmUpAbsoluteFilePath(array $loaders)
4756
{
57+
$this->expectUserDeprecationMessage('Since symfony/serializer 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
58+
4859
$file = sys_get_temp_dir().'/0/cache-serializer.php';
4960
@unlink($file);
5061

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/ValidatorCacheWarmerTest.php

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

1212
namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;
1313

14+
use Symfony\Bridge\PhpUnit\ExpectUserDeprecationMessageTrait;
1415
use Symfony\Bundle\FrameworkBundle\CacheWarmer\ValidatorCacheWarmer;
1516
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
1617
use Symfony\Component\Cache\Adapter\NullAdapter;
@@ -20,8 +21,15 @@
2021

2122
class ValidatorCacheWarmerTest extends TestCase
2223
{
24+
use ExpectUserDeprecationMessageTrait;
25+
26+
/**
27+
* @group legacy
28+
*/
2329
public function testWarmUp()
2430
{
31+
$this->expectUserDeprecationMessage('Since symfony/validator 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
32+
2533
$validatorBuilder = new ValidatorBuilder();
2634
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
2735
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');
@@ -42,8 +50,13 @@ public function testWarmUp()
4250
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
4351
}
4452

53+
/**
54+
* @group legacy
55+
*/
4556
public function testWarmUpAbsoluteFilePath()
4657
{
58+
$this->expectUserDeprecationMessage('Since symfony/validator 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
59+
4760
$validatorBuilder = new ValidatorBuilder();
4861
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
4962
$validatorBuilder->addYamlMapping(__DIR__.'/../Fixtures/Validation/Resources/author.yml');

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/XmlFrameworkExtensionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1717

18+
/**
19+
* @group legacy
20+
*/
1821
class XmlFrameworkExtensionTest extends FrameworkExtensionTestCase
1922
{
2023
protected function loadFromFile(ContainerBuilder $container, $file)

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCompleteConfigurationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1717

18+
/**
19+
* @group legacy
20+
*/
1821
class XmlCompleteConfigurationTest extends CompleteConfigurationTestCase
1922
{
2023
public function testFirewallPatterns()

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomAuthenticatorTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2020

21+
/**
22+
* @group legacy
23+
*/
2124
class XmlCustomAuthenticatorTest extends TestCase
2225
{
2326
/**

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/XmlCustomProviderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
use Symfony\Component\DependencyInjection\ContainerBuilder;
1919
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2020

21+
/**
22+
* @group legacy
23+
*/
2124
class XmlCustomProviderTest extends TestCase
2225
{
2326
/**

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/DependencyInjection/FirewallEntryPointExtension.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
use Symfony\Component\Config\FileLocator;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Extension\Extension;
17-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17+
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
1818

1919
class FirewallEntryPointExtension extends Extension
2020
{
2121
public function load(array $configs, ContainerBuilder $container): void
2222
{
23-
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
24-
$loader->load('services.xml');
23+
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
24+
$loader->load('services.yml');
2525
}
2626
}

src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/FirewallEntryPointBundle/Resources/config/services.xml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
services:
2+
firewall_entry_point.entry_point.stub:
3+
class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\FirewallEntryPointBundle\Security\EntryPointStub

0 commit comments

Comments
 (0)