Skip to content

Commit cd2fc45

Browse files
minor #54382 [FrameworkBundle] Remove custom handler for Workflow listener attributes (GromNaN)
This PR was merged into the 7.1 branch. Discussion ---------- [FrameworkBundle] Remove custom handler for Workflow listener attributes | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT All the `Workflow\Attribute\As*Listener` classes extend `AsEventListener`. Since the attribute handler are now applied to child classes (#54365), it's no longer necessary to declare an attribute handler for each attribute. Discussed in #54365 (comment) Commits ------- db7004c Remove custom handler for Workflow listener attributes
2 parents 0b99d83 + db7004c commit cd2fc45

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,29 +1104,6 @@ private function registerWorkflowConfiguration(array $config, ContainerBuilder $
11041104
$container->setParameter('workflow.has_guard_listeners', true);
11051105
}
11061106
}
1107-
1108-
$listenerAttributes = [
1109-
Workflow\Attribute\AsAnnounceListener::class,
1110-
Workflow\Attribute\AsCompletedListener::class,
1111-
Workflow\Attribute\AsEnterListener::class,
1112-
Workflow\Attribute\AsEnteredListener::class,
1113-
Workflow\Attribute\AsGuardListener::class,
1114-
Workflow\Attribute\AsLeaveListener::class,
1115-
Workflow\Attribute\AsTransitionListener::class,
1116-
];
1117-
1118-
foreach ($listenerAttributes as $attribute) {
1119-
$container->registerAttributeForAutoconfiguration($attribute, static function (ChildDefinition $definition, AsEventListener $attribute, \ReflectionClass|\ReflectionMethod $reflector) {
1120-
$tagAttributes = get_object_vars($attribute);
1121-
if ($reflector instanceof \ReflectionMethod) {
1122-
if (isset($tagAttributes['method'])) {
1123-
throw new LogicException(sprintf('"%s" attribute cannot declare a method on "%s::%s()".', $attribute::class, $reflector->class, $reflector->name));
1124-
}
1125-
$tagAttributes['method'] = $reflector->getName();
1126-
}
1127-
$definition->addTag('kernel.event_listener', $tagAttributes);
1128-
});
1129-
}
11301107
}
11311108

11321109
private function registerDebugConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"ext-xml": "*",
2222
"symfony/cache": "^6.4|^7.0",
2323
"symfony/config": "^6.4|^7.0",
24-
"symfony/dependency-injection": "^6.4|^7.0",
24+
"symfony/dependency-injection": "^7.1",
2525
"symfony/deprecation-contracts": "^2.5|^3",
2626
"symfony/error-handler": "^6.4|^7.0",
2727
"symfony/event-dispatcher": "^6.4|^7.0",

0 commit comments

Comments
 (0)