Skip to content

Commit f64a8f3

Browse files
Merge branch '7.2' into 7.3
* 7.2: [Validator] Review Croatian translation [Validator] Review "twig template" translation Update Mailer Azure bridge API docs link Provide missing translations thanks to Gemini [DependencyInjection] Make `DefinitionErrorExceptionPass` consider `IGNORE_ON_UNINITIALIZED_REFERENCE` and `RUNTIME_EXCEPTION_ON_INVALID_REFERENCE` the same [FrameworkBundle] Fix declaring fiel-attr tags in xml config files [WebLink] Hint that prerender is deprecated [DependencyInjection] Fix missing binding for ServiceCollectionInterface when declaring a service subscriber
2 parents 5a6f679 + 8007d7a commit f64a8f3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Compiler/DefinitionErrorExceptionPass.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
6262
}
6363

6464
if ($value instanceof Reference && $this->currentId !== $targetId = (string) $value) {
65-
if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
65+
if (
66+
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior()
67+
|| ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior()
68+
) {
6669
$this->sourceReferences[$targetId][$this->currentId] ??= true;
6770
} else {
6871
$this->sourceReferences[$targetId][$this->currentId] = false;

Compiler/RegisterServiceSubscribersPass.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\DependencyInjection\Reference;
2121
use Symfony\Component\DependencyInjection\TypedReference;
2222
use Symfony\Contracts\Service\Attribute\SubscribedService;
23+
use Symfony\Contracts\Service\ServiceCollectionInterface;
2324
use Symfony\Contracts\Service\ServiceProviderInterface;
2425
use Symfony\Contracts\Service\ServiceSubscriberInterface;
2526

@@ -134,6 +135,7 @@ protected function processValue(mixed $value, bool $isRoot = false): mixed
134135
$value->setBindings([
135136
PsrContainerInterface::class => new BoundArgument($locatorRef, false),
136137
ServiceProviderInterface::class => new BoundArgument($locatorRef, false),
138+
ServiceCollectionInterface::class => new BoundArgument($locatorRef, false),
137139
] + $value->getBindings());
138140

139141
return parent::processValue($value);

Tests/Compiler/DefinitionErrorExceptionPassTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public function testSkipNestedErrors()
6464
$container->register('foo', 'stdClass')
6565
->addArgument(new Reference('bar', ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE));
6666

67+
$container->register('baz', 'stdClass')
68+
->addArgument(new Reference('bar', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE));
69+
6770
$pass = new DefinitionErrorExceptionPass();
6871
$pass->process($container);
6972

0 commit comments

Comments
 (0)