Skip to content

Commit f21defc

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

File tree

29 files changed

+446
-38
lines changed

29 files changed

+446
-38
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/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/ValidatorCacheWarmerTest.php

Lines changed: 18 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');
@@ -67,8 +80,13 @@ public function testWarmUpAbsoluteFilePath()
6780
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
6881
}
6982

83+
/**
84+
* @group legacy
85+
*/
7086
public function testWarmUpWithoutBuilDir()
7187
{
88+
$this->expectUserDeprecationMessage('Since symfony/validator 7.4: XML configuration format is deprecated, use YAML or attributes instead.');
89+
7290
$validatorBuilder = new ValidatorBuilder();
7391
$validatorBuilder->addXmlMapping(__DIR__.'/../Fixtures/Validation/Resources/person.xml');
7492
$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)