Skip to content

Commit fdd7f2f

Browse files
committed
Deprecate XML configuration format
1 parent 2478de5 commit fdd7f2f

File tree

36 files changed

+480
-124
lines changed

36 files changed

+480
-124
lines changed

UPGRADE-7.4.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DependencyInjection
2222
-------------------
2323

2424
* Add argument `$target` to `ContainerBuilder::registerAliasForArgument()`
25+
* Deprecate XML configuration format, use YAML or PHP instead
2526

2627
FrameworkBundle
2728
---------------
@@ -38,13 +39,23 @@ HttpFoundation
3839

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

42+
Routing
43+
-------
44+
45+
* Deprecate XML configuration format, use YAML, PHP or attributes instead
46+
4147
Security
4248
--------
4349

4450
* Deprecate callable firewall listeners, extend `AbstractListener` or implement `FirewallListenerInterface` instead
4551
* Deprecate `AbstractListener::__invoke`
4652
* Deprecate `LazyFirewallContext::__invoke()`
4753

54+
Serializer
55+
----------
56+
57+
* Deprecate XML configuration format, use YAML or attributes instead
58+
4859
Validator
4960
---------
5061

@@ -171,3 +182,4 @@ Validator
171182
}
172183
}
173184
```
185+
* Deprecate XML configuration format, use YAML or attributes instead

src/Symfony/Bridge/Doctrine/Tests/Fixtures/BaseUser.php

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

1212
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
1313

14+
use Symfony\Component\Validator\Constraints as Assert;
15+
1416
class BaseUser
1517
{
1618
private $enabled;
1719

1820
public function __construct(
1921
private readonly int $id,
22+
23+
#[Assert\NotBlank(groups: ['Registration'])]
24+
#[Assert\Length(min: 2, max: 120, groups: ['Registration'])]
2025
private readonly string $username,
2126
) {
2227
}

src/Symfony/Bridge/Doctrine/Tests/Resources/validator/BaseUser.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ public function testFieldMappingsConfiguration()
159159
{
160160
$validator = Validation::createValidatorBuilder()
161161
->enableAttributeMapping()
162-
->addXmlMappings([__DIR__.'/../Resources/validator/BaseUser.xml'])
163162
->addLoader(
164163
new DoctrineLoader(
165164
DoctrineTestHelper::createTestEntityManager(

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

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,29 @@
2222
class SerializerCacheWarmerTest extends TestCase
2323
{
2424
/**
25-
* @dataProvider loaderProvider
25+
* @dataProvider yamlLoaderProvider
2626
*/
27-
public function testWarmUp(array $loaders)
27+
public function testYamlWarmUp(array $loaders)
28+
{
29+
$file = sys_get_temp_dir().'/cache-serializer.php';
30+
@unlink($file);
31+
32+
$warmer = new SerializerCacheWarmer($loaders, $file);
33+
$warmer->warmUp(\dirname($file), \dirname($file));
34+
35+
$this->assertFileExists($file);
36+
37+
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
38+
39+
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
40+
}
41+
42+
/**
43+
* @group legacy
44+
*
45+
* @dataProvider xmlLoaderProvider
46+
*/
47+
public function testXmlWarmUp(array $loaders)
2848
{
2949
$file = sys_get_temp_dir().'/cache-serializer.php';
3050
@unlink($file);
@@ -37,13 +57,35 @@ public function testWarmUp(array $loaders)
3757
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
3858

3959
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person')->isHit());
60+
}
61+
62+
/**
63+
* @dataProvider yamlLoaderProvider
64+
*/
65+
public function testYamlWarmUpAbsoluteFilePath(array $loaders)
66+
{
67+
$file = sys_get_temp_dir().'/0/cache-serializer.php';
68+
@unlink($file);
69+
70+
$cacheDir = sys_get_temp_dir().'/1';
71+
72+
$warmer = new SerializerCacheWarmer($loaders, $file);
73+
$warmer->warmUp($cacheDir, $cacheDir);
74+
75+
$this->assertFileExists($file);
76+
$this->assertFileDoesNotExist($cacheDir.'/cache-serializer.php');
77+
78+
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
79+
4080
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
4181
}
4282

4383
/**
44-
* @dataProvider loaderProvider
84+
* @group legacy
85+
*
86+
* @dataProvider xmlLoaderProvider
4587
*/
46-
public function testWarmUpAbsoluteFilePath(array $loaders)
88+
public function testXmlWarmUpAbsoluteFilePath(array $loaders)
4789
{
4890
$file = sys_get_temp_dir().'/0/cache-serializer.php';
4991
@unlink($file);
@@ -59,13 +101,32 @@ public function testWarmUpAbsoluteFilePath(array $loaders)
59101
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
60102

61103
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person')->isHit());
104+
}
105+
106+
/**
107+
* @dataProvider yamlLoaderProvider
108+
*/
109+
public function testYamlWarmUpWithoutBuildDir(array $loaders)
110+
{
111+
$file = sys_get_temp_dir().'/cache-serializer.php';
112+
@unlink($file);
113+
114+
$warmer = new SerializerCacheWarmer($loaders, $file);
115+
$warmer->warmUp(\dirname($file));
116+
117+
$this->assertFileDoesNotExist($file);
118+
119+
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
120+
62121
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
63122
}
64123

65124
/**
66-
* @dataProvider loaderProvider
125+
* @group legacy
126+
*
127+
* @dataProvider xmlLoaderProvider
67128
*/
68-
public function testWarmUpWithoutBuildDir(array $loaders)
129+
public function testXmlWarmUpWithoutBuildDir(array $loaders)
69130
{
70131
$file = sys_get_temp_dir().'/cache-serializer.php';
71132
@unlink($file);
@@ -78,29 +139,44 @@ public function testWarmUpWithoutBuildDir(array $loaders)
78139
$arrayPool = new PhpArrayAdapter($file, new NullAdapter());
79140

80141
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Person')->isHit());
81-
$this->assertTrue($arrayPool->getItem('Symfony_Bundle_FrameworkBundle_Tests_Fixtures_Serialization_Author')->isHit());
82142
}
83143

84-
public static function loaderProvider(): array
144+
public static function yamlLoaderProvider(): array
85145
{
86146
return [
87147
[
88148
[
89149
new LoaderChain([
90-
new XmlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/person.xml'),
91150
new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/author.yml'),
92151
]),
93152
],
94153
],
95154
[
96155
[
97-
new XmlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/person.xml'),
98156
new YamlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/author.yml'),
99157
],
100158
],
101159
];
102160
}
103161

162+
public static function xmlLoaderProvider(): array
163+
{
164+
return [
165+
[
166+
[
167+
new LoaderChain([
168+
new XmlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/person.xml'),
169+
]),
170+
],
171+
],
172+
[
173+
[
174+
new XmlFileLoader(__DIR__.'/../Fixtures/Serialization/Resources/person.xml'),
175+
],
176+
],
177+
];
178+
}
179+
104180
public function testWarmUpWithoutLoader()
105181
{
106182
$file = sys_get_temp_dir().'/cache-serializer-without-loader.php';

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
class ValidatorCacheWarmerTest extends TestCase
2222
{
23+
/**
24+
* @group legacy
25+
*/
2326
public function testWarmUp()
2427
{
2528
$validatorBuilder = new ValidatorBuilder();
@@ -42,6 +45,9 @@ public function testWarmUp()
4245
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
4346
}
4447

48+
/**
49+
* @group legacy
50+
*/
4551
public function testWarmUpAbsoluteFilePath()
4652
{
4753
$validatorBuilder = new ValidatorBuilder();
@@ -67,6 +73,9 @@ public function testWarmUpAbsoluteFilePath()
6773
$this->assertTrue($arrayPool->getItem('Symfony.Bundle.FrameworkBundle.Tests.Fixtures.Validation.Author')->isHit());
6874
}
6975

76+
/**
77+
* @group legacy
78+
*/
7079
public function testWarmUpWithoutBuilDir()
7180
{
7281
$validatorBuilder = new ValidatorBuilder();

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
/**

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