File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/Symfony/Component/DependencyInjection Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,6 @@ public function __construct()
7474 $ this ->beforeRemovingPasses = [
7575 -100 => [
7676 new ResolvePrivatesPass (),
77- new CheckExceptionOnInvalidReferenceBehaviorPass (),
7877 ],
7978 ];
8079
@@ -83,6 +82,7 @@ public function __construct()
8382 new ReplaceAliasByActualDefinitionPass (),
8483 new RemoveAbstractDefinitionsPass (),
8584 new RemoveUnusedDefinitionsPass (),
85+ new CheckExceptionOnInvalidReferenceBehaviorPass (),
8686 new InlineServiceDefinitionsPass (new AnalyzeServiceReferencesPass ()),
8787 new AnalyzeServiceReferencesPass (),
8888 new DefinitionErrorExceptionPass (),
Original file line number Diff line number Diff line change @@ -1338,6 +1338,25 @@ public function testGetThrownServiceNotFoundExceptionWithCorrectServiceId()
13381338 $ container ->compile ();
13391339 }
13401340
1341+ public function testUnusedServiceRemovedByPassAndServiceNotFoundExceptionWasNotThrown ()
1342+ {
1343+ $ container = new ContainerBuilder ();
1344+ $ container ->register ('service ' , \stdClass::class)
1345+ ->setPublic (false )
1346+ ->addArgument ([
1347+ 'non_existent_service ' => new Reference ('non_existent_service ' ),
1348+ ])
1349+ ;
1350+
1351+ try {
1352+ $ container ->compile ();
1353+ } catch (ServiceNotFoundException $ e ) {
1354+ $ this ->fail ('Should not be thrown ' );
1355+ }
1356+
1357+ $ this ->assertTrue (true );
1358+ }
1359+
13411360 public function testServiceLocator ()
13421361 {
13431362 $ container = new ContainerBuilder ();
You can’t perform that action at this time.
0 commit comments