@@ -375,14 +375,20 @@ private function set(string $type, string $id)
375
375
376
376
private function createTypeNotFoundMessageCallback (TypedReference $ reference , $ label )
377
377
{
378
- $ container = new ContainerBuilder ($ this ->container ->getParameterBag ());
379
- $ container ->setAliases ($ this ->container ->getAliases ());
380
- $ container ->setDefinitions ($ this ->container ->getDefinitions ());
381
- $ container ->setResourceTracking (false );
382
- $ currentId = $ this ->currentId ;
383
-
384
- return function () use ($ container , $ reference , $ label , $ currentId ) {
385
- return $ this ->createTypeNotFoundMessage ($ container , $ reference , $ label , $ currentId );
378
+ $ state = [
379
+ $ this ->container ->getParameterBag (),
380
+ $ this ->container ->getAliases (),
381
+ $ this ->container ->getDefinitions (),
382
+ $ this ->currentId ,
383
+ ];
384
+
385
+ return function () use ($ reference , $ label , $ state ) {
386
+ $ container = new ContainerBuilder ($ state [0 ]);
387
+ $ container ->setAliases ($ state [1 ]);
388
+ $ container ->setDefinitions ($ state [2 ]);
389
+ $ container ->setResourceTracking (false );
390
+
391
+ return $ this ->createTypeNotFoundMessage ($ container , $ reference , $ label , $ state [3 ]);
386
392
};
387
393
}
388
394
0 commit comments