Skip to content

Commit 7d3f4fe

Browse files
committed
feature #61179 [DependencyInjection] Remove !tagged tag, use !tagged_iterator instead (nicolas-grekas)
This PR was merged into the 8.0 branch. Discussion ---------- [DependencyInjection] Remove `!tagged` tag, use `!tagged_iterator` instead | Q | A | ------------- | --- | Branch? | 8.0 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | - | License | MIT Commits ------- b4868bd [DependencyInjection] Remove `!tagged` tag, use `!tagged_iterator` instead
2 parents 000ade9 + b4868bd commit 7d3f4fe

File tree

7 files changed

+3
-44
lines changed

7 files changed

+3
-44
lines changed

UPGRADE-8.0.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ DependencyInjection
122122
public function __construct(#[AutowireIterator('app.my_tag')] private iterable $services) {}
123123
}
124124
```
125-
125+
* Remove `!tagged` tag, use `!tagged_iterator` instead
126126
* Remove the `ContainerBuilder::getAutoconfiguredAttributes()` method, use `getAttributeAutoconfigurators()` instead to retrieve all the callbacks for a specific attribute class
127127

128128
DoctrineBridge

src/Symfony/Component/DependencyInjection/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Remove `#[TaggedIterator]` and `#[TaggedLocator]` attributes, replaced by `#[AutowireLocator]` and `#[AutowireIterator]`
88
* Remove `ContainerBuilder::getAutoconfiguredAttributes()`, replaced by `ContainerBuilder::getAttributeAutoconfigurators()`
9+
* Remove `!tagged` tag, use `!tagged_iterator` instead
910

1011
7.4
1112
---

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,9 +630,6 @@ private function getArgumentsAsPhp(\DOMElement $node, string $name, string $file
630630
$arg = $this->getArgumentsAsPhp($arg, $name, $file);
631631
$arguments[$key] = new ServiceLocatorArgument($arg);
632632
break;
633-
case 'tagged':
634-
trigger_deprecation('symfony/dependency-injection', '7.2', 'Type "tagged" is deprecated for tag <%s>, use "tagged_iterator" instead in "%s".', $name, $file);
635-
// no break
636633
case 'tagged_iterator':
637634
case 'tagged_locator':
638635
$forLocator = 'tagged_locator' === $type;

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -852,11 +852,7 @@ private function resolveServices(mixed $value, string $file, bool $isParameter =
852852

853853
return new ServiceLocatorArgument($argument);
854854
}
855-
if (\in_array($value->getTag(), ['tagged', 'tagged_iterator', 'tagged_locator'], true)) {
856-
if ('tagged' === $value->getTag()) {
857-
trigger_deprecation('symfony/dependency-injection', '7.2', 'Using "!tagged" is deprecated, use "!tagged_iterator" instead in "%s".', $file);
858-
}
859-
855+
if (\in_array($value->getTag(), ['tagged_iterator', 'tagged_locator'], true)) {
860856
$forLocator = 'tagged_locator' === $value->getTag();
861857

862858
if (\is_array($argument) && isset($argument['tag']) && $argument['tag']) {

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services_with_deprecated_tagged.xml

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

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,19 +1335,6 @@ public function testUnknownConstantAsKey()
13351335
$loader->load('key_type_wrong_constant.xml');
13361336
}
13371337

1338-
/**
1339-
* @group legacy
1340-
*/
1341-
public function testDeprecatedTagged()
1342-
{
1343-
$container = new ContainerBuilder();
1344-
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
1345-
1346-
$this->expectUserDeprecationMessage(\sprintf('Since symfony/dependency-injection 7.2: Type "tagged" is deprecated for tag <argument>, use "tagged_iterator" instead in "%s/xml%sservices_with_deprecated_tagged.xml".', self::$fixturesPath, \DIRECTORY_SEPARATOR));
1347-
1348-
$loader->load('services_with_deprecated_tagged.xml');
1349-
}
1350-
13511338
public function testLoadServicesWithEnvironment()
13521339
{
13531340
$container = new ContainerBuilder();

src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,17 +1211,4 @@ public function testStaticConstructor()
12111211
$definition = $container->getDefinition('static_constructor');
12121212
$this->assertEquals((new Definition('stdClass'))->setFactory([null, 'create']), $definition);
12131213
}
1214-
1215-
/**
1216-
* @group legacy
1217-
*/
1218-
public function testDeprecatedTagged()
1219-
{
1220-
$container = new ContainerBuilder();
1221-
$loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml'));
1222-
1223-
$this->expectUserDeprecationMessage(\sprintf('Since symfony/dependency-injection 7.2: Using "!tagged" is deprecated, use "!tagged_iterator" instead in "%s/yaml%stagged_deprecated.yml".', self::$fixturesPath, \DIRECTORY_SEPARATOR));
1224-
1225-
$loader->load('tagged_deprecated.yml');
1226-
}
12271214
}

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