@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $root = new Container(); |
| 31 | 31 | $root->bind('foo', SampleClass::class); |
| 32 | 32 | |
| 33 | - $root->runScoped(function (ContainerInterface $c1) { |
|
| 33 | + $root->runScoped(function (ContainerInterface $c1){ |
|
| 34 | 34 | $c1->get('foo'); |
| 35 | 35 | }, bindings: ['foo' => SampleClass::class]); |
| 36 | 36 | |
@@ -297,20 +297,20 @@ discard block |
||
| 297 | 297 | $root = new Container(); |
| 298 | 298 | $root->bindSingleton('sampleClass', SampleClass::class); |
| 299 | 299 | |
| 300 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 300 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 301 | 301 | $this->assertTrue($container->has('sampleClass')); |
| 302 | 302 | }); |
| 303 | 303 | |
| 304 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 305 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 304 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 305 | + $container->runScope(new Scope('bar'), function (Container $container){ |
|
| 306 | 306 | $this->assertTrue($container->has('sampleClass')); |
| 307 | 307 | }); |
| 308 | 308 | }); |
| 309 | 309 | |
| 310 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 310 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 311 | 311 | $container->bindSingleton('otherClass', SampleClass::class); |
| 312 | 312 | |
| 313 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 313 | + $container->runScope(new Scope('bar'), function (Container $container){ |
|
| 314 | 314 | $this->assertTrue($container->has('sampleClass')); |
| 315 | 315 | $this->assertTrue($container->has('otherClass')); |
| 316 | 316 | }); |
@@ -322,33 +322,33 @@ discard block |
||
| 322 | 322 | $root = new Container(); |
| 323 | 323 | $root->getBinder('foo')->bindSingleton('sampleClass', AttrScopeFoo::class); |
| 324 | 324 | |
| 325 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 325 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 326 | 326 | $this->assertTrue($container->has('sampleClass')); |
| 327 | 327 | }); |
| 328 | 328 | |
| 329 | - $root->runScope(new Scope('bar'), function (Container $container) { |
|
| 329 | + $root->runScope(new Scope('bar'), function (Container $container){ |
|
| 330 | 330 | $this->assertFalse($container->has('sampleClass')); |
| 331 | 331 | }); |
| 332 | 332 | |
| 333 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 334 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 333 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 334 | + $container->runScope(new Scope('bar'), function (Container $container){ |
|
| 335 | 335 | $this->assertTrue($container->has('sampleClass')); |
| 336 | 336 | }); |
| 337 | 337 | }); |
| 338 | 338 | |
| 339 | - $root->runScope(new Scope('foo'), function (Container $container) { |
|
| 339 | + $root->runScope(new Scope('foo'), function (Container $container){ |
|
| 340 | 340 | $container->bindSingleton('otherClass', AttrScopeFoo::class); |
| 341 | 341 | |
| 342 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 342 | + $container->runScope(new Scope('bar'), function (Container $container){ |
|
| 343 | 343 | $this->assertTrue($container->has('sampleClass')); |
| 344 | 344 | $this->assertTrue($container->has('otherClass')); |
| 345 | 345 | }); |
| 346 | 346 | }); |
| 347 | 347 | |
| 348 | - $root->runScope(new Scope('baz'), function (Container $container) { |
|
| 348 | + $root->runScope(new Scope('baz'), function (Container $container){ |
|
| 349 | 349 | $container->getBinder('foo')->bindSingleton('otherClass', AttrScopeFoo::class); |
| 350 | 350 | |
| 351 | - $container->runScope(new Scope('bar'), function (Container $container) { |
|
| 351 | + $container->runScope(new Scope('bar'), function (Container $container){ |
|
| 352 | 352 | $this->assertFalse($container->has('sampleClass')); |
| 353 | 353 | $this->assertFalse($container->has('otherClass')); |
| 354 | 354 | }); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | use DestructorTrait; |
| 20 | 20 | |
| 21 | 21 | private State $state; |
| 22 | - private FactoryInterface|Factory $factory; |
|
| 22 | + private FactoryInterface | Factory $factory; |
|
| 23 | 23 | private Scope $scope; |
| 24 | 24 | |
| 25 | 25 | public function __construct(Registry $constructor) |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | * @throws ContainerException |
| 50 | 50 | * @throws \Throwable |
| 51 | 51 | */ |
| 52 | - public function get(string|Autowire $id, \Stringable|string|null $context = null): mixed |
|
| 52 | + public function get(string | Autowire $id, \Stringable | string | null $context = null): mixed |
|
| 53 | 53 | { |
| 54 | - if ($id instanceof Autowire) { |
|
| 54 | + if ($id instanceof Autowire){ |
|
| 55 | 55 | return $id->resolve($this->factory); |
| 56 | 56 | } |
| 57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function has(string $id): bool |
| 63 | 63 | { |
| 64 | - if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons)) { |
|
| 64 | + if (\array_key_exists($id, $this->state->bindings) || \array_key_exists($id, $this->state->singletons)){ |
|
| 65 | 65 | return true; |
| 66 | 66 | } |
| 67 | 67 | |