Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit aac7e01

Browse filesBrowse files
committed
Add the Exclude attribute to the array in the ContainerBuilder
1 parent e46ab36 commit aac7e01
Copy full SHA for aac7e01

File tree

2 files changed

+3
-3
lines changed
Filter options

2 files changed

+3
-3
lines changed

‎src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/ContainerBuilder.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
2828
use Symfony\Component\DependencyInjection\Argument\ServiceLocator;
2929
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;
30+
use Symfony\Component\DependencyInjection\Attribute\Exclude;
3031
use Symfony\Component\DependencyInjection\Attribute\Target;
3132
use Symfony\Component\DependencyInjection\Compiler\Compiler;
3233
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
@@ -134,7 +135,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
134135
/**
135136
* @var array<class-string>
136137
*/
137-
private array $exclusionAttributes = [];
138+
private array $exclusionAttributes = [Exclude::class];
138139

139140
/**
140141
* @var array<string, bool>

‎src/Symfony/Component/DependencyInjection/Loader/FileLoader.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Loader/FileLoader.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ public function registerClasses(Definition $prototype, string $namespace, string
124124

125125
foreach ($classes as $class => $errorMessage) {
126126
if (null === $errorMessage && $autoconfigureAttributes) {
127+
$r = $this->container->getReflectionClass($class);
127128
$exclusionAttributes = $this->container->getExclusionAttributes();
128-
$exclusionAttributes[] = Exclude::class;
129129

130-
$r = $this->container->getReflectionClass($class);
131130
foreach ($exclusionAttributes as $attribute) {
132131
if ($r->getAttributes($attribute)[0] ?? null) {
133132
$this->addContainerExcludedTag($class, $source);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.