@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | { |
| 72 | 72 | $container = new Container(); |
| 73 | 73 | |
| 74 | - $container->bindSingleton('sampleClass', function () { |
|
| 74 | + $container->bindSingleton('sampleClass', function (){ |
|
| 75 | 75 | return new SampleClass(); |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $container = new Container(); |
| 99 | 99 | $container->bindSingleton('singleton', 'sampleClass'); |
| 100 | 100 | |
| 101 | - $container->bind('sampleClass', function () { |
|
| 101 | + $container->bind('sampleClass', function (){ |
|
| 102 | 102 | return new SampleClass(); |
| 103 | 103 | }); |
| 104 | 104 | |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $this->assertNull(ContainerScope::getContainer()); |
| 36 | 36 | |
| 37 | - try { |
|
| 37 | + try{ |
|
| 38 | 38 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
| 39 | 39 | throw new RuntimeException('exception'); |
| 40 | 40 | })); |
| 41 | - } catch (\Throwable $e) { |
|
| 41 | + }catch (\Throwable $e){ |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $this->assertTrue($c->runScope([ |
| 57 | 57 | 'bucket' => new Bucket('b'), |
| 58 | 58 | 'other' => new SampleClass() |
| 59 | - ], function ($c) { |
|
| 59 | + ], function ($c){ |
|
| 60 | 60 | $this->assertSame('b', $c->get('bucket')->getName()); |
| 61 | 61 | $this->assertTrue($c->has('other')); |
| 62 | 62 | |
@@ -78,21 +78,21 @@ discard block |
||
| 78 | 78 | $this->assertTrue($c->runScope([ |
| 79 | 79 | 'bucket' => new Bucket('b'), |
| 80 | 80 | 'other' => new SampleClass() |
| 81 | - ], function ($c) { |
|
| 81 | + ], function ($c){ |
|
| 82 | 82 | $this->assertSame('b', $c->get('bucket')->getName()); |
| 83 | 83 | $this->assertTrue($c->has('other')); |
| 84 | 84 | |
| 85 | 85 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
| 86 | 86 | })); |
| 87 | 87 | |
| 88 | - try { |
|
| 88 | + try{ |
|
| 89 | 89 | $this->assertTrue($c->runScope([ |
| 90 | 90 | 'bucket' => new Bucket('b'), |
| 91 | 91 | 'other' => new SampleClass() |
| 92 | 92 | ], function () use ($c): void { |
| 93 | 93 | throw new RuntimeException('exception'); |
| 94 | 94 | })); |
| 95 | - } catch (\Throwable $e) { |
|
| 95 | + }catch (\Throwable $e){ |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | ContainerScope::runScope($container, static fn (ContainerInterface $container) => $container) |
| 109 | 109 | ); |
| 110 | 110 | |
| 111 | - $result = ContainerScope::runScope($container, static function (Container $container) { |
|
| 111 | + $result = ContainerScope::runScope($container, static function (Container $container){ |
|
| 112 | 112 | return $container->runScope([], static fn (Container $container) => $container); |
| 113 | 113 | }); |
| 114 | 114 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $container->bindSingleton('test', new #[Singleton] class {}); |
| 140 | 140 | $container->make('test'); |
| 141 | 141 | |
| 142 | - $container->runScoped(function (Container $container) { |
|
| 142 | + $container->runScoped(function (Container $container){ |
|
| 143 | 143 | $this->assertTrue($container->hasInstance('test')); |
| 144 | 144 | }); |
| 145 | 145 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $container->bindSingleton('test', SampleClass::class); |
| 151 | 151 | $container->make('test'); |
| 152 | 152 | |
| 153 | - $container->runScoped(function (Container $container) { |
|
| 153 | + $container->runScoped(function (Container $container){ |
|
| 154 | 154 | $this->assertTrue($container->hasInstance('test')); |
| 155 | 155 | }); |
| 156 | 156 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $container->bindSingleton('bar', 'foo'); |
| 166 | 166 | $container->make('bar'); |
| 167 | 167 | |
| 168 | - $container->runScoped(function (Container $container) { |
|
| 168 | + $container->runScoped(function (Container $container){ |
|
| 169 | 169 | $this->assertTrue($container->hasInstance('bar')); |
| 170 | 170 | }); |
| 171 | 171 | } |