@@ -20,6 +20,6 @@ |
||
| 20 | 20 | bool $bool, |
| 21 | 21 | array $array = [], |
| 22 | 22 | string $pong = null |
| 23 | - ) { |
|
| 23 | + ){ |
|
| 24 | 24 | } |
| 25 | 25 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $container = new Container(); |
| 42 | 42 | $this->assertInstanceOf(FactoryInterface::class, $container); |
| 43 | 43 | |
| 44 | - $container->bind(Bucket::class, function ($data) { |
|
| 44 | + $container->bind(Bucket::class, function ($data){ |
|
| 45 | 45 | return new Bucket('via-closure', $data); |
| 46 | 46 | }); |
| 47 | 47 | |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | $this->assertNull(ContainerScope::getContainer()); |
| 42 | 42 | |
| 43 | - try { |
|
| 43 | + try{ |
|
| 44 | 44 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
| 45 | 45 | throw new RuntimeException('exception'); |
| 46 | 46 | })); |
| 47 | - } catch (\Throwable $e) { |
|
| 47 | + }catch (\Throwable $e){ |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
| 92 | 92 | })); |
| 93 | 93 | |
| 94 | - try { |
|
| 94 | + try{ |
|
| 95 | 95 | $this->assertTrue($c->runScope([ |
| 96 | 96 | 'bucket' => new Bucket('b'), |
| 97 | 97 | 'other' => new SampleClass() |
| 98 | 98 | ], function () use ($c): void { |
| 99 | 99 | throw new RuntimeException('exception'); |
| 100 | 100 | })); |
| 101 | - } catch (\Throwable $e) { |
|
| 101 | + }catch (\Throwable $e){ |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $this->assertSame('a', $c->get('bucket')->getName()); |
@@ -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 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function testInvalidInjector(): void |
| 38 | 38 | { |
| 39 | - $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an " . |
|
| 39 | + $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an ". |
|
| 40 | 40 | "instance of InjectorInterface for 'Spiral\Tests\Core\Fixtures\TestConfig'"; |
| 41 | 41 | $this->expectException(InjectionException::class); |
| 42 | 42 | $this->expectExceptionMessage($excepted); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | public function testInvalidRuntimeInjector(): void |
| 62 | 62 | { |
| 63 | - $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an " . |
|
| 63 | + $excepted = "Class 'Spiral\Tests\Core\Fixtures\InvalidInjector' must be an ". |
|
| 64 | 64 | "instance of InjectorInterface for 'Spiral\Tests\Core\Fixtures\TestConfig'"; |
| 65 | 65 | $this->expectException(InjectionException::class); |
| 66 | 66 | $this->expectExceptionMessage($excepted); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $container->bind(ConfigsInterface::class, $configurator); |
| 126 | 126 | |
| 127 | 127 | $configurator->shouldReceive('createInjection') |
| 128 | - ->with(m::on(static function (ReflectionClass $r) { |
|
| 128 | + ->with(m::on(static function (ReflectionClass $r){ |
|
| 129 | 129 | return $r->getName() === TestConfig::class; |
| 130 | 130 | }), null) |
| 131 | 131 | ->andReturn($expected) |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $container->bind(ConfigsInterface::class, $configurator); |
| 144 | 144 | |
| 145 | 145 | $configurator->shouldReceive('createInjection') |
| 146 | - ->with(m::on(static function (ReflectionClass $r) { |
|
| 146 | + ->with(m::on(static function (ReflectionClass $r){ |
|
| 147 | 147 | return $r->getName() === TestConfig::class; |
| 148 | 148 | }), 'context') |
| 149 | 149 | ->andReturn($expected) |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | $container->bind(ConfigsInterface::class, $configurator); |
| 162 | 162 | |
| 163 | 163 | $configurator->shouldReceive('createInjection') |
| 164 | - ->with(m::on(static function (ReflectionClass $r) { |
|
| 164 | + ->with(m::on(static function (ReflectionClass $r){ |
|
| 165 | 165 | return $r->getName() === TestConfig::class; |
| 166 | 166 | }), 'contextArgument') |
| 167 | 167 | ->andReturn($expected) |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $this->assertFalse($container->has('abc')); |
| 27 | 27 | |
| 28 | - $container->bind('abc', function () { |
|
| 28 | + $container->bind('abc', function (){ |
|
| 29 | 29 | return 'hello'; |
| 30 | 30 | }); |
| 31 | 31 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $container = new Container(); |
| 39 | 39 | |
| 40 | 40 | $this->assertFalse($container->has('abc')); |
| 41 | - $container->bind('abc', function () { |
|
| 41 | + $container->bind('abc', function (){ |
|
| 42 | 42 | return 'hello'; |
| 43 | 43 | }); |
| 44 | 44 | |
@@ -46,11 +46,11 @@ |
||
| 46 | 46 | { |
| 47 | 47 | [$previous, self::$container] = [self::$container, $container]; |
| 48 | 48 | |
| 49 | - try { |
|
| 49 | + try{ |
|
| 50 | 50 | return $scope(); |
| 51 | - } catch (Throwable $e) { |
|
| 51 | + }catch (Throwable $e){ |
|
| 52 | 52 | throw $e; |
| 53 | - } finally { |
|
| 53 | + }finally{ |
|
| 54 | 54 | self::$container = $previous; |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -44,8 +44,8 @@ |
||
| 44 | 44 | $this->context = $context; |
| 45 | 45 | |
| 46 | 46 | $name = $context->getName(); |
| 47 | - if ($context instanceof ReflectionMethod) { |
|
| 48 | - $name = $context->class . '::' . $name; |
|
| 47 | + if ($context instanceof ReflectionMethod){ |
|
| 48 | + $name = $context->class.'::'.$name; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | parent::__construct("Unable to resolve '{$parameter->name}' argument in '{$name}'"); |
@@ -58,22 +58,22 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public static function wire($definition): Autowire |
| 60 | 60 | { |
| 61 | - if ($definition instanceof self) { |
|
| 61 | + if ($definition instanceof self){ |
|
| 62 | 62 | return $definition; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if (is_string($definition)) { |
|
| 65 | + if (is_string($definition)){ |
|
| 66 | 66 | return new Autowire($definition); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if (is_array($definition) && isset($definition['class'])) { |
|
| 69 | + if (is_array($definition) && isset($definition['class'])){ |
|
| 70 | 70 | return new Autowire( |
| 71 | 71 | $definition['class'], |
| 72 | 72 | $definition['options'] ?? $definition['params'] ?? [] |
| 73 | 73 | ); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (is_object($definition)) { |
|
| 76 | + if (is_object($definition)){ |
|
| 77 | 77 | $autowire = new self(get_class($definition), []); |
| 78 | 78 | $autowire->target = $definition; |
| 79 | 79 | return $autowire; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function resolve(FactoryInterface $factory, array $parameters = []) |
| 94 | 94 | { |
| 95 | - if ($this->target !== null) { |
|
| 95 | + if ($this->target !== null){ |
|
| 96 | 96 | // pre-wired |
| 97 | 97 | return $this->target; |
| 98 | 98 | } |