Skip to content

Commit c102159

Browse files
minor symfony#61651 [FrameworkBundle] do not parse attributes on abstract classes with DI < 7.4 (xabbuh)
This PR was merged into the 7.4 branch. Discussion ---------- [FrameworkBundle] do not parse attributes on abstract classes with DI < 7.4 | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT see failures on the low deps job: https://github.com/symfony/symfony/actions/runs/17460089102/job/49582532853#step:9:6141 Commits ------- 13691fc do not parse attributes on abstract classes with DI < 7.4
2 parents d465645 + 13691fc commit c102159

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
use Symfony\Component\Console\Debug\CliRequest;
6161
use Symfony\Component\Console\Messenger\RunCommandMessageHandler;
6262
use Symfony\Component\DependencyInjection\Alias;
63+
use Symfony\Component\DependencyInjection\Argument\ArgumentTrait;
6364
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
6465
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
6566
use Symfony\Component\DependencyInjection\ChildDefinition;
@@ -1817,7 +1818,7 @@ private function registerValidationConfiguration(array $config, ContainerBuilder
18171818

18181819
// When attributes are disabled, it means from runtime-discovery only; autoconfiguration should still happen.
18191820
// And when runtime-discovery of attributes is enabled, we can skip compile-time autoconfiguration in debug mode.
1820-
if (class_exists(ValidatorAttributeMetadataPass::class) && (!($config['enable_attributes'] ?? false) || !$container->getParameter('kernel.debug'))) {
1821+
if (class_exists(ValidatorAttributeMetadataPass::class) && (!($config['enable_attributes'] ?? false) || !$container->getParameter('kernel.debug')) && trait_exists(ArgumentTrait::class)) {
18211822
// The $reflector argument hints at where the attribute could be used
18221823
$container->registerAttributeForAutoconfiguration(Constraint::class, function (ChildDefinition $definition, Constraint $attribute, \ReflectionClass|\ReflectionMethod|\ReflectionProperty $reflector) {
18231824
$definition->addTag('validator.attribute_metadata');

0 commit comments

Comments
 (0)