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

Commitc86c6e1

Browse files
committed
[DI] fixed incorrect report for private services if required service does not exist
1 parentb60bb6e commitc86c6e1

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function __construct()
7474
$this->beforeRemovingPasses = [
7575
-100 => [
7676
newResolvePrivatesPass(),
77+
newCheckExceptionOnInvalidReferenceBehaviorPass(),
7778
],
7879
];
7980

@@ -88,7 +89,6 @@ public function __construct()
8889
]];
8990

9091
$this->afterRemovingPasses = [[
91-
newCheckExceptionOnInvalidReferenceBehaviorPass(),
9292
newResolveHotPathPass(),
9393
]];
9494
}

‎src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,28 @@ public function testNoClassFromNsSeparatorId()
13161316
$container->compile();
13171317
}
13181318

1319+
publicfunctiontestGetThrownServiceNotFoundExceptionWithCorrectServiceId()
1320+
{
1321+
$this->expectException(ServiceNotFoundException::class);
1322+
$this->expectExceptionMessage('The service "child_service" has a dependency on a non-existent service "non_existent_service".');
1323+
1324+
$container =newContainerBuilder();
1325+
$container->register('child_service', \stdClass::class)
1326+
->setPublic(false)
1327+
->addArgument([
1328+
'non_existent' =>newReference('non_existent_service'),
1329+
])
1330+
;
1331+
$container->register('parent_service', \stdClass::class)
1332+
->setPublic(true)
1333+
->addArgument([
1334+
'child_service' =>newReference('child_service'),
1335+
])
1336+
;
1337+
1338+
$container->compile();
1339+
}
1340+
13191341
publicfunctiontestServiceLocator()
13201342
{
13211343
$container =newContainerBuilder();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp