Skip to content

Commit 08a196e

Browse files
[DependencyInjection][Routing] Remove support for the XML configuration format
1 parent 0e791f5 commit 08a196e

File tree

93 files changed

+1
-4080
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1
-4080
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ CHANGELOG
1010
* Remove `ContainerBuilder::getAutoconfiguredAttributes()`, replaced by `ContainerBuilder::getAttributeAutoconfigurators()`
1111
* Remove `!tagged` tag, use `!tagged_iterator` instead
1212
* Add argument `$target` to `ContainerBuilder::registerAliasForArgument()`
13+
* Remove support for the XML configuration format
1314

1415
7.4
1516
---

Extension/ExtensionTrait.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use Symfony\Component\DependencyInjection\Loader\GlobFileLoader;
2323
use Symfony\Component\DependencyInjection\Loader\IniFileLoader;
2424
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
25-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2625
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
2726

2827
/**
@@ -55,7 +54,6 @@ private function createContainerLoader(ContainerBuilder $container, string $env,
5554
$buildDir = $container->getParameter('kernel.build_dir');
5655
$locator = new FileLocator();
5756
$resolver = new LoaderResolver([
58-
new XmlFileLoader($container, $locator, $env, $prepend),
5957
new YamlFileLoader($container, $locator, $env, $prepend),
6058
new IniFileLoader($container, $locator, $env),
6159
new PhpFileLoader($container, $locator, $env, new ConfigBuilderGenerator($buildDir), $prepend),

Loader/XmlFileLoader.php

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

Loader/schema/dic/services/services-1.0.xsd

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

Tests/Compiler/AutowirePassTest.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use Psr\Log\LoggerInterface;
1919
use Psr\Log\NullLogger;
2020
use Symfony\Bridge\PhpUnit\ClassExistsMock;
21-
use Symfony\Component\Config\FileLocator;
2221
use Symfony\Component\Config\Resource\ClassExistenceResource;
2322
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
2423
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
@@ -32,7 +31,6 @@
3231
use Symfony\Component\DependencyInjection\ContainerInterface;
3332
use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException;
3433
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
35-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
3634
use Symfony\Component\DependencyInjection\Reference;
3735
use Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface;
3836
use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass;
@@ -989,22 +987,6 @@ public function testExceptionWhenAliasDoesNotExist()
989987
}
990988
}
991989

992-
#[IgnoreDeprecations]
993-
#[Group('legacy')]
994-
public function testInlineServicesAreNotCandidates()
995-
{
996-
$this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead.');
997-
998-
$container = new ContainerBuilder();
999-
$loader = new XmlFileLoader($container, new FileLocator(realpath(__DIR__.'/../Fixtures/xml')));
1000-
$loader->load('services_inline_not_candidate.xml');
1001-
1002-
$pass = new AutowirePass();
1003-
$pass->process($container);
1004-
1005-
$this->assertSame([], $container->getDefinition('autowired')->getArguments());
1006-
}
1007-
1008990
public function testAutowireDecorator()
1009991
{
1010992
$container = new ContainerBuilder();

Tests/CrossCheckTest.php

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,10 @@
1212
namespace Symfony\Component\DependencyInjection\Tests;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15-
use PHPUnit\Framework\Attributes\Group;
16-
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1715
use PHPUnit\Framework\TestCase;
1816
use Symfony\Component\Config\FileLocator;
1917
use Symfony\Component\DependencyInjection\ContainerBuilder;
20-
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
2118
use Symfony\Component\DependencyInjection\Dumper\YamlDumper;
22-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2319
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
2420

2521
class CrossCheckTest extends TestCase
@@ -34,49 +30,6 @@ public static function setUpBeforeClass(): void
3430
require_once self::$fixturesPath.'/includes/foo.php';
3531
}
3632

37-
#[IgnoreDeprecations]
38-
#[Group('legacy')]
39-
#[DataProvider('crossCheckXmlLoadersDumpers')]
40-
public function testXmlCrossCheck($fixture)
41-
{
42-
$this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead.');
43-
44-
$tmp = tempnam(sys_get_temp_dir(), 'sf');
45-
46-
copy(self::$fixturesPath.'/xml/'.$fixture, $tmp);
47-
48-
$container1 = new ContainerBuilder();
49-
$loader1 = new XmlFileLoader($container1, new FileLocator());
50-
$loader1->load($tmp);
51-
52-
$dumper = new XmlDumper($container1);
53-
file_put_contents($tmp, $dumper->dump());
54-
55-
$container2 = new ContainerBuilder();
56-
$loader2 = new XmlFileLoader($container2, new FileLocator());
57-
$loader2->load($tmp);
58-
59-
unlink($tmp);
60-
61-
$this->assertEquals($container1->getAliases(), $container2->getAliases(), 'loading a dump from a previously loaded container returns the same container');
62-
$this->assertEquals($container1->getDefinitions(), $container2->getDefinitions(), 'loading a dump from a previously loaded container returns the same container');
63-
$this->assertEquals($container1->getParameterBag()->all(), $container2->getParameterBag()->all(), '->getParameterBag() returns the same value for both containers');
64-
$this->assertEquals(serialize($container1), serialize($container2), 'loading a dump from a previously loaded container returns the same container');
65-
66-
$services1 = [];
67-
foreach ($container1 as $id => $service) {
68-
$services1[$id] = serialize($service);
69-
}
70-
$services2 = [];
71-
foreach ($container2 as $id => $service) {
72-
$services2[$id] = serialize($service);
73-
}
74-
75-
unset($services1['service_container'], $services2['service_container']);
76-
77-
$this->assertEquals($services1, $services2, 'Iterator on the containers returns the same services');
78-
}
79-
8033
#[DataProvider('crossCheckYamlLoadersDumpers')]
8134
public function testYamlCrossCheck($fixture)
8235
{
@@ -116,17 +69,6 @@ public function testYamlCrossCheck($fixture)
11669
$this->assertEquals($services2, $services1, 'Iterator on the containers returns the same services');
11770
}
11871

119-
public static function crossCheckXmlLoadersDumpers()
120-
{
121-
return [
122-
['services1.xml'],
123-
['services2.xml'],
124-
['services6.xml'],
125-
['services8.xml'],
126-
['services9.xml'],
127-
];
128-
}
129-
13072
public static function crossCheckYamlLoadersDumpers()
13173
{
13274
return [

Tests/Dumper/XmlDumperTest.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Dumper;
1313

1414
use PHPUnit\Framework\Attributes\DataProvider;
15-
use PHPUnit\Framework\Attributes\Group;
16-
use PHPUnit\Framework\Attributes\IgnoreDeprecations;
1715
use PHPUnit\Framework\TestCase;
18-
use Symfony\Component\Config\FileLocator;
1916
use Symfony\Component\DependencyInjection\Argument\AbstractArgument;
2017
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
2118
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
@@ -24,7 +21,6 @@
2421
use Symfony\Component\DependencyInjection\ContainerBuilder;
2522
use Symfony\Component\DependencyInjection\ContainerInterface;
2623
use Symfony\Component\DependencyInjection\Dumper\XmlDumper;
27-
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
2824
use Symfony\Component\DependencyInjection\Reference;
2925
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooClassWithDefaultArrayAttribute;
3026
use Symfony\Component\DependencyInjection\Tests\Fixtures\FooClassWithDefaultEnumAttribute;
@@ -191,22 +187,6 @@ public function testDumpAutowireData()
191187
$this->assertEquals(file_get_contents(self::$fixturesPath.'/xml/services24.xml'), $dumper->dump());
192188
}
193189

194-
#[IgnoreDeprecations]
195-
#[Group('legacy')]
196-
public function testDumpLoad()
197-
{
198-
$this->expectUserDeprecationMessage('Since symfony/dependency-injection 7.4: XML configuration format is deprecated, use YAML or PHP instead.');
199-
200-
$container = new ContainerBuilder();
201-
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
202-
$loader->load('services_dump_load.xml');
203-
204-
$this->assertEquals([new Reference('bar', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)], $container->getDefinition('foo')->getArguments());
205-
206-
$dumper = new XmlDumper($container);
207-
$this->assertStringEqualsFile(self::$fixturesPath.'/xml/services_dump_load.xml', $dumper->dump());
208-
}
209-
210190
public function testTaggedArguments()
211191
{
212192
$taggedIterator = new TaggedIteratorArgument('foo_tag', 'barfoo', 'foobar', false, 'getPriority');

Tests/Fixtures/includes/ProjectWithXsdExtension.php

Lines changed: 0 additions & 25 deletions
This file was deleted.
-1.38 KB
Binary file not shown.

Tests/Fixtures/includes/createphar.php

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

0 commit comments

Comments
 (0)