Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit72171c0

Browse files
committed
[DependencyInjection] MakeDefinitionErrorExceptionPass considerIGNORE_ON_UNINITIALIZED_REFERENCE andRUNTIME_EXCEPTION_ON_INVALID_REFERENCE the same
1 parent1fb9d17 commit72171c0

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

‎src/Symfony/Component/DependencyInjection/Compiler/DefinitionErrorExceptionPass.php

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

6767
if ($valueinstanceof Reference &&$this->currentId !==$targetId = (string)$value) {
68-
if (ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE ===$value->getInvalidBehavior()) {
68+
if (
69+
ContainerInterface::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE ===$value->getInvalidBehavior()
70+
|| ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE ===$value->getInvalidBehavior()
71+
) {
6972
$this->sourceReferences[$targetId][$this->currentId] ??=true;
7073
}else {
7174
$this->sourceReferences[$targetId][$this->currentId] =false;

‎src/Symfony/Component/DependencyInjection/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(newReference('bar', ContainerBuilder::RUNTIME_EXCEPTION_ON_INVALID_REFERENCE));
6666

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp