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 cdb6eb3

Browse filesBrowse files
committed
Add the Exclude attribute to the array in the ContainerBuilder
1 parent 05b7c73 commit cdb6eb3
Copy full SHA for cdb6eb3

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
@@ -139,10 +139,9 @@ public function registerClasses(Definition $prototype, string $namespace, string
139139

140140
foreach ($classes as $class => $errorMessage) {
141141
if (null === $errorMessage && $autoconfigureAttributes) {
142+
$r = $this->container->getReflectionClass($class);
142143
$exclusionAttributes = $this->container->getExclusionAttributes();
143-
$exclusionAttributes[] = Exclude::class;
144144

145-
$r = $this->container->getReflectionClass($class);
146145
foreach ($exclusionAttributes as $attribute) {
147146
if ($r->getAttributes($attribute)[0] ?? null) {
148147
$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.