Skip to content

Commit 953f505

Browse files
[FrameworkBundle] Simplify registration of #[AsRoutingConditionService]
1 parent 123b165 commit 953f505

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
use Symfony\Bridge\Twig\Extension\CsrfExtension;
2828
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2929
use Symfony\Bundle\FrameworkBundle\Routing\AnnotatedRouteControllerLoader;
30-
use Symfony\Bundle\FrameworkBundle\Routing\Attribute\AsRoutingConditionService;
3130
use Symfony\Bundle\FrameworkBundle\Routing\RouteLoaderInterface;
3231
use Symfony\Bundle\FullStack;
3332
use Symfony\Bundle\MercureBundle\MercureBundle;
@@ -683,10 +682,6 @@ public function load(array $configs, ContainerBuilder $container)
683682
'kernel.locale_aware',
684683
'kernel.reset',
685684
]);
686-
687-
$container->registerAttributeForAutoconfiguration(AsRoutingConditionService::class, static function (ChildDefinition $definition, AsRoutingConditionService $attribute): void {
688-
$definition->addTag('routing.condition_service', (array) $attribute);
689-
});
690685
}
691686

692687
/**

src/Symfony/Bundle/FrameworkBundle/Routing/Attribute/AsRoutingConditionService.php

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

1212
namespace Symfony\Bundle\FrameworkBundle\Routing\Attribute;
1313

14+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
15+
1416
/**
1517
* Service tag to autoconfigure routing condition services.
1618
*
@@ -37,11 +39,12 @@
3739
* }
3840
*/
3941
#[\Attribute(\Attribute::TARGET_CLASS)]
40-
class AsRoutingConditionService
42+
class AsRoutingConditionService extends AutoconfigureTag
4143
{
4244
public function __construct(
43-
public ?string $alias = null,
44-
public int $priority = 0,
45+
string $alias = null,
46+
int $priority = 0,
4547
) {
48+
parent::__construct('routing.condition_service', ['alias' => $alias, 'priority' => $priority]);
4649
}
4750
}

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
"composer-runtime-api": ">=2.1",
2121
"ext-xml": "*",
2222
"symfony/cache": "^5.4|^6.0",
23-
"symfony/config": "^5.4|^6.0",
24-
"symfony/dependency-injection": "^5.4.5|^6.0.5",
23+
"symfony/config": "^6.1",
24+
"symfony/dependency-injection": "^6.1",
2525
"symfony/deprecation-contracts": "^2.1|^3",
26+
"symfony/error-handler": "^6.1",
2627
"symfony/event-dispatcher": "^5.4|^6.0",
27-
"symfony/error-handler": "^5.4|^6.0",
2828
"symfony/http-foundation": "^5.4|^6.0",
2929
"symfony/http-kernel": "^6.1",
3030
"symfony/polyfill-mbstring": "~1.0",
@@ -55,7 +55,7 @@
5555
"symfony/rate-limiter": "^5.4|^6.0",
5656
"symfony/security-bundle": "^5.4|^6.0",
5757
"symfony/semaphore": "^5.4|^6.0",
58-
"symfony/serializer": "^5.4|^6.0",
58+
"symfony/serializer": "^6.1",
5959
"symfony/stopwatch": "^5.4|^6.0",
6060
"symfony/string": "^5.4|^6.0",
6161
"symfony/translation": "^5.4|^6.0",

0 commit comments

Comments
 (0)