Passed
Pull Request — master (#1090)
by Aleksei
12:12
created
src/Boot/tests/KernelTest.php 1 patch
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -47,7 +47,8 @@  discard block
 block discarded – undo
47 47
     {
48 48
         $kernel = TestCore::create(['root' => __DIR__])->run();
49 49
 
50
-        $d = new class() implements DispatcherInterface {
50
+        $d = new class() implements DispatcherInterface
51
+        {
51 52
             public static function canServe(EnvironmentInterface $env): bool
52 53
             {
53 54
                 return true;
@@ -67,7 +68,8 @@  discard block
 block discarded – undo
67 68
     {
68 69
         $kernel = TestCore::create(['root' => __DIR__])->run();
69 70
 
70
-        $d = new class() implements DispatcherInterface {
71
+        $d = new class() implements DispatcherInterface
72
+        {
71 73
             public function canServe(): bool
72 74
             {
73 75
                 return true;
@@ -90,7 +92,8 @@  discard block
 block discarded – undo
90 92
     {
91 93
         $kernel = TestCore::create(['root' => __DIR__])->run();
92 94
 
93
-        $d = new class() implements DispatcherInterface {
95
+        $d = new class() implements DispatcherInterface
96
+        {
94 97
             public static function canServe(EnvironmentInterface $env): bool
95 98
             {
96 99
                 return true;
@@ -124,19 +127,23 @@  discard block
 block discarded – undo
124 127
     {
125 128
         $kernel = TestCore::create(['root' => __DIR__]);
126 129
 
127
-        $kernel->booting(static function (TestCore $core) {
130
+        $kernel->booting(static function (TestCore $core)
131
+        {
128 132
             $core->getContainer()->bind('abc', 'foo');
129 133
         });
130 134
 
131
-        $kernel->booting(static function (TestCore $core) {
135
+        $kernel->booting(static function (TestCore $core)
136
+        {
132 137
             $core->getContainer()->bind('bcd', 'foo');
133 138
         });
134 139
 
135
-        $kernel->booted( static function (TestCore $core) {
140
+        $kernel->booted( static function (TestCore $core)
141
+        {
136 142
             $core->getContainer()->bind('cde', 'foo');
137 143
         });
138 144
 
139
-        $kernel->booted( static function (TestCore $core) {
145
+        $kernel->booted( static function (TestCore $core)
146
+        {
140 147
             $core->getContainer()->bind('def', 'foo');
141 148
         });
142 149
 
@@ -159,7 +166,8 @@  discard block
 block discarded – undo
159 166
 
160 167
     public function testEventsShouldBeDispatched(): void
161 168
     {
162
-        $testDispatcher = new class implements DispatcherInterface {
169
+        $testDispatcher = new class implements DispatcherInterface
170
+        {
163 171
             public static function canServe(EnvironmentInterface $env): bool
164 172
             {
165 173
                 return true;
Please login to merge, or discard this patch.
src/Boot/src/AbstractKernel.php 1 patch
Braces   +39 added lines, -19 removed lines patch added patch discarded remove patch
@@ -120,29 +120,35 @@  discard block
 block discarded – undo
120 120
     ): static {
121 121
         $exceptionHandler ??= ExceptionHandler::class;
122 122
 
123
-        if (\is_string($exceptionHandler)) {
123
+        if (\is_string($exceptionHandler))
124
+        {
124 125
             $exceptionHandler = $container->make($exceptionHandler);
125 126
         }
126 127
 
127
-        if ($handleErrors) {
128
+        if ($handleErrors)
129
+        {
128 130
             $exceptionHandler->register();
129 131
         }
130 132
 
131
-        if (!$container->has(InitializerInterface::class)) {
133
+        if (!$container->has(InitializerInterface::class))
134
+        {
132 135
             $container->bind(InitializerInterface::class, Initializer::class);
133 136
         }
134
-        if (!$container->has(InvokerStrategyInterface::class)) {
137
+        if (!$container->has(InvokerStrategyInterface::class))
138
+        {
135 139
             $container->bind(InvokerStrategyInterface::class, DefaultInvokerStrategy::class);
136 140
         }
137 141
 
138
-        if ($bootloadManager instanceof Autowire) {
142
+        if ($bootloadManager instanceof Autowire)
143
+        {
139 144
             $bootloadManager = $bootloadManager->resolve($container);
140 145
         }
141 146
         $bootloadManager ??= $container->make(StrategyBasedBootloadManager::class);
142 147
         \assert($bootloadManager instanceof BootloadManagerInterface);
143 148
         $container->bind(BootloadManagerInterface::class, $bootloadManager);
144 149
 
145
-        if (!$container->has(BootloaderRegistryInterface::class)) {
150
+        if (!$container->has(BootloaderRegistryInterface::class))
151
+        {
146 152
             $container->bindSingleton(BootloaderRegistryInterface::class, [self::class, 'initBootloaderRegistry']);
147 153
         }
148 154
 
@@ -171,7 +177,8 @@  discard block
 block discarded – undo
171 177
         $environment ??= new Environment();
172 178
         $this->container->bindSingleton(EnvironmentInterface::class, $environment);
173 179
 
174
-        try {
180
+        try
181
+        {
175 182
             // will protect any against env overwrite action
176 183
             $this->container->runScope(
177 184
                 [EnvironmentInterface::class => $environment],
@@ -188,7 +195,9 @@  discard block
 block discarded – undo
188 195
                     $this->fireCallbacks($this->bootstrappedCallbacks);
189 196
                 }
190 197
             );
191
-        } catch (\Throwable $e) {
198
+        }
199
+        catch (\Throwable $e)
200
+        {
192 201
             $this->exceptionHandler->handleGlobalException($e);
193 202
 
194 203
             return null;
@@ -209,7 +218,8 @@  discard block
 block discarded – undo
209 218
      */
210 219
     public function running(Closure ...$callbacks): void
211 220
     {
212
-        foreach ($callbacks as $callback) {
221
+        foreach ($callbacks as $callback)
222
+        {
213 223
             $this->runningCallbacks[] = $callback;
214 224
         }
215 225
     }
@@ -224,7 +234,8 @@  discard block
 block discarded – undo
224 234
      */
225 235
     public function booting(Closure ...$callbacks): void
226 236
     {
227
-        foreach ($callbacks as $callback) {
237
+        foreach ($callbacks as $callback)
238
+        {
228 239
             $this->bootingCallbacks[] = $callback;
229 240
         }
230 241
     }
@@ -239,7 +250,8 @@  discard block
 block discarded – undo
239 250
      */
240 251
     public function booted(Closure ...$callbacks): void
241 252
     {
242
-        foreach ($callbacks as $callback) {
253
+        foreach ($callbacks as $callback)
254
+        {
243 255
             $this->bootedCallbacks[] = $callback;
244 256
         }
245 257
     }
@@ -255,7 +267,8 @@  discard block
 block discarded – undo
255 267
      */
256 268
     public function bootstrapped(Closure ...$callbacks): void
257 269
     {
258
-        foreach ($callbacks as $callback) {
270
+        foreach ($callbacks as $callback)
271
+        {
259 272
             $this->bootstrappedCallbacks[] = $callback;
260 273
         }
261 274
     }
@@ -269,7 +282,8 @@  discard block
 block discarded – undo
269 282
      */
270 283
     public function addDispatcher(string|DispatcherInterface $dispatcher): self
271 284
     {
272
-        if (\is_object($dispatcher)) {
285
+        if (\is_object($dispatcher))
286
+        {
273 287
             $dispatcher = $dispatcher::class;
274 288
         }
275 289
 
@@ -291,19 +305,22 @@  discard block
 block discarded – undo
291 305
         $eventDispatcher?->dispatch(new Serving());
292 306
 
293 307
         $serving = $servingScope = null;
294
-        foreach ($this->dispatchers as $dispatcher) {
308
+        foreach ($this->dispatchers as $dispatcher)
309
+        {
295 310
             $reflection = new \ReflectionClass($dispatcher);
296 311
 
297 312
             $scope = ($reflection->getAttributes(DispatcherScope::class)[0] ?? null)?->newInstance()->scope;
298 313
             $this->container->getBinder($scope)->bind($dispatcher, $dispatcher);
299 314
 
300
-            if ($serving === null && $this->canServe($reflection)) {
315
+            if ($serving === null && $this->canServe($reflection))
316
+            {
301 317
                 $serving = $dispatcher;
302 318
                 $servingScope = $scope;
303 319
             }
304 320
         }
305 321
 
306
-        if ($serving === null) {
322
+        if ($serving === null)
323
+        {
307 324
             $eventDispatcher?->dispatch(new DispatcherNotFound());
308 325
             throw new BootException('Unable to locate active dispatcher.');
309 326
         }
@@ -352,11 +369,13 @@  discard block
 block discarded – undo
352 369
      */
353 370
     protected function fireCallbacks(array &$callbacks): void
354 371
     {
355
-        if ($callbacks === []) {
372
+        if ($callbacks === [])
373
+        {
356 374
             return;
357 375
         }
358 376
 
359
-        do {
377
+        do
378
+        {
360 379
             $this->container->invoke(\current($callbacks));
361 380
         } while (\next($callbacks));
362 381
 
@@ -398,7 +417,8 @@  discard block
 block discarded – undo
398 417
      */
399 418
     private function canServe(\ReflectionClass $reflection): bool
400 419
     {
401
-        if (!$reflection->hasMethod('canServe')) {
420
+        if (!$reflection->hasMethod('canServe'))
421
+        {
402 422
             throw new BootException('Dispatcher must implement static `canServe` method.');
403 423
         }
404 424
 
Please login to merge, or discard this patch.
src/Core/tests/Scope/UseCaseTest.php 1 patch
Braces   +50 added lines, -25 removed lines patch added patch discarded remove patch
@@ -34,7 +34,8 @@  discard block
 block discarded – undo
34 34
         $root = new Container();
35 35
         $root->bind('foo', SampleClass::class);
36 36
 
37
-        $root->runScoped(function (ContainerInterface $c1) {
37
+        $root->runScoped(function (ContainerInterface $c1)
38
+        {
38 39
             $c1->get('foo');
39 40
         }, bindings: ['foo' => SampleClass::class]);
40 41
 
@@ -67,7 +68,8 @@  discard block
 block discarded – undo
67 68
     {
68 69
         $root = new Container();
69 70
 
70
-        $root->runScoped(function (ContainerInterface $c1) use ($theSame, $alias) {
71
+        $root->runScoped(function (ContainerInterface $c1) use ($theSame, $alias)
72
+        {
71 73
             $obj1 = $c1->get($alias);
72 74
             $obj2 = $c1->get($alias);
73 75
 
@@ -92,14 +94,16 @@  discard block
 block discarded – undo
92 94
     {
93 95
         $root = new Container();
94 96
 
95
-        $root->runScoped(function (ContainerInterface $c1) use ($root) {
97
+        $root->runScoped(function (ContainerInterface $c1) use ($root)
98
+        {
96 99
             $obj1 = $c1->get('foo');
97 100
             $this->weakMap->offsetSet($obj1, true);
98 101
 
99 102
             self::assertNotSame($root, $c1);
100 103
             self::assertInstanceOf(stdClass::class, $obj1);
101 104
 
102
-            $c1->runScoped(function (ContainerInterface $c2) use ($root, $c1, $obj1) {
105
+            $c1->runScoped(function (ContainerInterface $c2) use ($root, $c1, $obj1)
106
+            {
103 107
                 $obj2 = $c2->get('foo');
104 108
                 $this->weakMap->offsetSet($obj2, true);
105 109
 
@@ -128,14 +132,16 @@  discard block
 block discarded – undo
128 132
         $root->bindSingleton('bar', [Factory::class, 'makeStdClass']);
129 133
         $root->bind(stdClass::class, new stdClass());
130 134
 
131
-        $root->runScoped(function (ContainerInterface $c1) use ($root) {
135
+        $root->runScoped(function (ContainerInterface $c1) use ($root)
136
+        {
132 137
             $obj1 = $c1->get('foo');
133 138
             $this->weakMap->offsetSet($obj1, true);
134 139
 
135 140
             self::assertInstanceOf(stdClass::class, $obj1);
136 141
             // Singleton must be the same
137 142
             self::assertSame($c1->get('bar'), $root->get('bar'));
138
-            $c1->runScoped(function (ContainerInterface $c2) use ($root, $obj1) {
143
+            $c1->runScoped(function (ContainerInterface $c2) use ($root, $obj1)
144
+            {
139 145
                 $obj2 = $c2->get('foo');
140 146
 
141 147
                 self::assertInstanceOf(stdClass::class, $obj2);
@@ -268,7 +274,8 @@  discard block
 block discarded – undo
268 274
     {
269 275
         $root = new Container();
270 276
 
271
-        $root->invoke(static function () use ($root) {
277
+        $root->invoke(static function () use ($root)
278
+        {
272 279
             self::assertNotNull(\Spiral\Core\ContainerScope::getContainer());
273 280
             self::assertSame($root, \Spiral\Core\ContainerScope::getContainer());
274 281
         });
@@ -277,7 +284,8 @@  discard block
 block discarded – undo
277 284
     public function testRegisterContainerOnGet(): void
278 285
     {
279 286
         $root = new Container();
280
-        $root->bind('foo', function () use ($root) {
287
+        $root->bind('foo', function () use ($root)
288
+        {
281 289
             self::assertNotNull(\Spiral\Core\ContainerScope::getContainer());
282 290
             self::assertSame($root, \Spiral\Core\ContainerScope::getContainer());
283 291
         });
@@ -288,7 +296,8 @@  discard block
 block discarded – undo
288 296
     public function testRegisterContainerOnMake(): void
289 297
     {
290 298
         $root = new Container();
291
-        $root->bind('foo', function () use ($root) {
299
+        $root->bind('foo', function () use ($root)
300
+        {
292 301
             self::assertNotNull(\Spiral\Core\ContainerScope::getContainer());
293 302
             self::assertSame($root, \Spiral\Core\ContainerScope::getContainer());
294 303
         });
@@ -306,7 +315,8 @@  discard block
 block discarded – undo
306 315
         $root->bind('isFoo', new Scalar(false));
307 316
         $root->getBinder('foo')->bind('isFoo', new Scalar(true));
308 317
 
309
-        $root->bind('foo', function (#[Proxy] ContainerInterface $c, ContainerInterface $r) use ($root) {
318
+        $root->bind('foo', function (#[Proxy] ContainerInterface $c, ContainerInterface $r) use ($root)
319
+        {
310 320
             // Direct
311 321
             self::assertNotNull(\Spiral\Core\ContainerScope::getContainer());
312 322
             self::assertNotSame($root, \Spiral\Core\ContainerScope::getContainer());
@@ -321,7 +331,8 @@  discard block
 block discarded – undo
321 331
 
322 332
         $root->runScope(
323 333
             new Scope('foo'),
324
-            function (ContainerInterface $c) {
334
+            function (ContainerInterface $c)
335
+            {
325 336
                 self::assertTrue($c->get('isFoo'));
326 337
                 $c->get('foo');
327 338
             }
@@ -334,7 +345,8 @@  discard block
 block discarded – undo
334 345
         $root = new Container();
335 346
         $root->getBinder($scope)->bindSingleton('foo', SampleClass::class);
336 347
 
337
-        $root->runScope(new Scope($scope), function (Container $container) {
348
+        $root->runScope(new Scope($scope), function (Container $container)
349
+        {
338 350
             $this->assertTrue($container->has('foo'));
339 351
             $this->assertInstanceOf(SampleClass::class, $container->get('foo'));
340 352
         });
@@ -346,20 +358,25 @@  discard block
 block discarded – undo
346 358
         $root = new Container();
347 359
         $root->bindSingleton('sampleClass', SampleClass::class);
348 360
 
349
-        $root->runScope(new Scope('foo'), function (Container $container) {
361
+        $root->runScope(new Scope('foo'), function (Container $container)
362
+        {
350 363
             $this->assertTrue($container->has('sampleClass'));
351 364
         });
352 365
 
353
-        $root->runScope(new Scope('foo'), function (Container $container) {
354
-            $container->runScope(new Scope('bar'), function (Container $container) {
366
+        $root->runScope(new Scope('foo'), function (Container $container)
367
+        {
368
+            $container->runScope(new Scope('bar'), function (Container $container)
369
+            {
355 370
                 $this->assertTrue($container->has('sampleClass'));
356 371
             });
357 372
         });
358 373
 
359
-        $root->runScope(new Scope('foo'), function (Container $container) {
374
+        $root->runScope(new Scope('foo'), function (Container $container)
375
+        {
360 376
             $container->bindSingleton('otherClass', SampleClass::class);
361 377
 
362
-            $container->runScope(new Scope('bar'), function (Container $container) {
378
+            $container->runScope(new Scope('bar'), function (Container $container)
379
+            {
363 380
                 $this->assertTrue($container->has('sampleClass'));
364 381
                 $this->assertTrue($container->has('otherClass'));
365 382
             });
@@ -371,33 +388,41 @@  discard block
 block discarded – undo
371 388
         $root = new Container();
372 389
         $root->getBinder('foo')->bindSingleton('sampleClass', AttrScopeFoo::class);
373 390
 
374
-        $root->runScope(new Scope('foo'), function (Container $container) {
391
+        $root->runScope(new Scope('foo'), function (Container $container)
392
+        {
375 393
             $this->assertTrue($container->has('sampleClass'));
376 394
         });
377 395
 
378
-        $root->runScope(new Scope('bar'), function (Container $container) {
396
+        $root->runScope(new Scope('bar'), function (Container $container)
397
+        {
379 398
             $this->assertFalse($container->has('sampleClass'));
380 399
         });
381 400
 
382
-        $root->runScope(new Scope('foo'), function (Container $container) {
383
-            $container->runScope(new Scope('bar'), function (Container $container) {
401
+        $root->runScope(new Scope('foo'), function (Container $container)
402
+        {
403
+            $container->runScope(new Scope('bar'), function (Container $container)
404
+            {
384 405
                 $this->assertTrue($container->has('sampleClass'));
385 406
             });
386 407
         });
387 408
 
388
-        $root->runScope(new Scope('foo'), function (Container $container) {
409
+        $root->runScope(new Scope('foo'), function (Container $container)
410
+        {
389 411
             $container->bindSingleton('otherClass', AttrScopeFoo::class);
390 412
 
391
-            $container->runScope(new Scope('bar'), function (Container $container) {
413
+            $container->runScope(new Scope('bar'), function (Container $container)
414
+            {
392 415
                 $this->assertTrue($container->has('sampleClass'));
393 416
                 $this->assertTrue($container->has('otherClass'));
394 417
             });
395 418
         });
396 419
 
397
-        $root->runScope(new Scope('baz'), function (Container $container) {
420
+        $root->runScope(new Scope('baz'), function (Container $container)
421
+        {
398 422
             $container->getBinder('foo')->bindSingleton('otherClass', AttrScopeFoo::class);
399 423
 
400
-            $container->runScope(new Scope('bar'), function (Container $container) {
424
+            $container->runScope(new Scope('bar'), function (Container $container)
425
+            {
401 426
                 $this->assertFalse($container->has('sampleClass'));
402 427
                 $this->assertFalse($container->has('otherClass'));
403 428
             });
Please login to merge, or discard this patch.
src/Core/src/Container.php 1 patch
Braces   +48 added lines, -22 removed lines patch added patch discarded remove patch
@@ -62,7 +62,8 @@  discard block
 block discarded – undo
62 62
         string|\BackedEnum|null $scopeName = self::DEFAULT_ROOT_SCOPE_NAME,
63 63
         private Options $options = new Options(),
64 64
     ) {
65
-        if (\is_object($scopeName)) {
65
+        if (\is_object($scopeName))
66
+        {
66 67
             $scopeName = (string) $scopeName->value;
67 68
         }
68 69
 
@@ -177,23 +178,29 @@  discard block
 block discarded – undo
177 178
      */
178 179
     public function runScope(Scope|array $bindings, callable $scope): mixed
179 180
     {
180
-        if (!\is_array($bindings)) {
181
+        if (!\is_array($bindings))
182
+        {
181 183
             return $this->runIsolatedScope($bindings, $scope);
182 184
         }
183 185
 
184 186
         $binds = &$this->state->bindings;
185 187
         $singletons = &$this->state->singletons;
186 188
         $cleanup = $previous = $prevSin = [];
187
-        foreach ($bindings as $alias => $resolver) {
189
+        foreach ($bindings as $alias => $resolver)
190
+        {
188 191
             // Store previous bindings
189
-            if (isset($binds[$alias])) {
192
+            if (isset($binds[$alias]))
193
+            {
190 194
                 $previous[$alias] = $binds[$alias];
191
-            } else {
195
+            }
196
+            else
197
+            {
192 198
                 // Store bindings to be removed
193 199
                 $cleanup[] = $alias;
194 200
             }
195 201
             // Store previous singletons
196
-            if (isset($singletons[$alias])) {
202
+            if (isset($singletons[$alias]))
203
+            {
197 204
                 $prevSin[$alias] = $singletons[$alias];
198 205
                 unset($singletons[$alias]);
199 206
             }
@@ -201,21 +208,27 @@  discard block
 block discarded – undo
201 208
             $this->binder->bind($alias, $resolver);
202 209
         }
203 210
 
204
-        try {
211
+        try
212
+        {
205 213
             return ContainerScope::getContainer() !== $this
206 214
                 ? ContainerScope::runScope($this, $scope)
207 215
                 : $scope($this);
208
-        } finally {
216
+        }
217
+        finally
218
+        {
209 219
             // Remove new bindings
210
-            foreach ($cleanup as $alias) {
220
+            foreach ($cleanup as $alias)
221
+            {
211 222
                 unset($binds[$alias], $singletons[$alias]);
212 223
             }
213 224
             // Restore previous bindings
214
-            foreach ($previous as $alias => $resolver) {
225
+            foreach ($previous as $alias => $resolver)
226
+            {
215 227
                 $binds[$alias] = $resolver;
216 228
             }
217 229
             // Restore singletons
218
-            foreach ($prevSin as $alias => $instance) {
230
+            foreach ($prevSin as $alias => $instance)
231
+            {
219 232
                 $singletons[$alias] = $instance;
220 233
             }
221 234
         }
@@ -263,7 +276,8 @@  discard block
 block discarded – undo
263 276
      */
264 277
     public function bindSingleton(string $alias, string|array|callable|object $resolver, bool $force = true): void
265 278
     {
266
-        if ($force) {
279
+        if ($force)
280
+        {
267 281
             $this->binder->removeBinding($alias);
268 282
         }
269 283
 
@@ -334,8 +348,10 @@  discard block
 block discarded – undo
334 348
         ], $this->options);
335 349
 
336 350
         // Create container services
337
-        foreach ($container->config as $property => $class) {
338
-            if (\property_exists($container, $property)) {
351
+        foreach ($container->config as $property => $class)
352
+        {
353
+            if (\property_exists($container, $property))
354
+            {
339 355
                 $container->$property = $constructor->get($property, $class);
340 356
             }
341 357
         }
@@ -349,7 +365,8 @@  discard block
 block discarded – undo
349 365
     private function closeScope(): void
350 366
     {
351 367
         /** @psalm-suppress RedundantPropertyInitializationCheck */
352
-        if (!isset($this->scope)) {
368
+        if (!isset($this->scope))
369
+        {
353 370
             $this->destruct();
354 371
             return;
355 372
         }
@@ -358,10 +375,14 @@  discard block
 block discarded – undo
358 375
 
359 376
         // Run finalizers
360 377
         $errors = [];
361
-        foreach ($this->state->finalizers as $finalizer) {
362
-            try {
378
+        foreach ($this->state->finalizers as $finalizer)
379
+        {
380
+            try
381
+            {
363 382
                 $this->invoker->invoke($finalizer);
364
-            } catch (\Throwable $e) {
383
+            }
384
+            catch (\Throwable $e)
385
+            {
365 386
                 $errors[] = $e;
366 387
             }
367 388
         }
@@ -370,7 +391,8 @@  discard block
 block discarded – undo
370 391
         $this->destruct();
371 392
 
372 393
         // Throw collected errors
373
-        if ($errors !== []) {
394
+        if ($errors !== [])
395
+        {
374 396
             throw new FinalizersException($scopeName, $errors);
375 397
         }
376 398
     }
@@ -392,18 +414,22 @@  discard block
 block discarded – undo
392 414
         $container->scope->setParent($this, $this->scope, $this->factory);
393 415
 
394 416
         // Add specific bindings
395
-        foreach ($config->bindings as $alias => $resolver) {
417
+        foreach ($config->bindings as $alias => $resolver)
418
+        {
396 419
             $container->binder->bind($alias, $resolver);
397 420
         }
398 421
 
399 422
         return ContainerScope::runScope(
400 423
             $container,
401 424
             static function (self $container) use ($config, $closure): mixed {
402
-                try {
425
+                try
426
+                {
403 427
                     return $config->autowire
404 428
                         ? $container->invoke($closure)
405 429
                         : $closure($container);
406
-                } finally {
430
+                }
431
+                finally
432
+                {
407 433
                     $container->closeScope();
408 434
                 }
409 435
             }
Please login to merge, or discard this patch.