@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 44 | 44 | |
| 45 | 45 | $w->shouldReceive('receive')->once()->with( |
| 46 | - \Mockery::on(function (&$context) { |
|
| 46 | + \Mockery::on(function (&$context){ |
|
| 47 | 47 | $context = $this->arrayToContextString(TestJob::class); |
| 48 | 48 | |
| 49 | 49 | return true; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $this->app->getContainer()->bind(Worker::class, $w); |
| 69 | 69 | |
| 70 | 70 | $w->shouldReceive('receive')->once()->with( |
| 71 | - \Mockery::on(function (&$context) { |
|
| 71 | + \Mockery::on(function (&$context){ |
|
| 72 | 72 | $context = $this->arrayToContextString(ErrorJob::class); |
| 73 | 73 | |
| 74 | 74 | return true; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $w->shouldReceive('receive')->once()->andReturn(null); |
| 82 | 82 | |
| 83 | 83 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 84 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 84 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 85 | 85 | ); |
| 86 | 86 | |
| 87 | 87 | $this->assertCount(0, $files); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $this->app->get(JobDispatcher::class)->serve(); |
| 90 | 90 | |
| 91 | 91 | $files = $this->app->get(FilesInterface::class)->getFiles( |
| 92 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
| 92 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
| 93 | 93 | ); |
| 94 | 94 | |
| 95 | 95 | $this->assertCount(1, $files); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | return \json_encode([ |
| 109 | 109 | 'id' => (string)$id, |
| 110 | - 'job' => \strtolower(\implode('.', $signature)) . '.' . $class |
|
| 110 | + 'job' => \strtolower(\implode('.', $signature)).'.'.$class |
|
| 111 | 111 | ]); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -43,7 +43,8 @@ discard block |
||
| 43 | 43 | $this->assertNull($this->app->getEnvironment()->get('FIRED')); |
| 44 | 44 | |
| 45 | 45 | $w->shouldReceive('receive')->once()->with( |
| 46 | - \Mockery::on(function (&$context) { |
|
| 46 | + \Mockery::on(function (&$context) |
|
| 47 | + { |
|
| 47 | 48 | $context = $this->arrayToContextString(TestJob::class); |
| 48 | 49 | |
| 49 | 50 | return true; |
@@ -68,7 +69,8 @@ discard block |
||
| 68 | 69 | $this->app->getContainer()->bind(Worker::class, $w); |
| 69 | 70 | |
| 70 | 71 | $w->shouldReceive('receive')->once()->with( |
| 71 | - \Mockery::on(function (&$context) { |
|
| 72 | + \Mockery::on(function (&$context) |
|
| 73 | + { |
|
| 72 | 74 | $context = $this->arrayToContextString(ErrorJob::class); |
| 73 | 75 | |
| 74 | 76 | return true; |
@@ -19,14 +19,14 @@ |
||
| 19 | 19 | { |
| 20 | 20 | parent::tearDown(); |
| 21 | 21 | |
| 22 | - if (file_exists(sys_get_temp_dir() . '/messages.ru.php')) { |
|
| 23 | - unlink(sys_get_temp_dir() . '/messages.ru.php'); |
|
| 22 | + if (file_exists(sys_get_temp_dir().'/messages.ru.php')){ |
|
| 23 | + unlink(sys_get_temp_dir().'/messages.ru.php'); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | public function testReset(): void |
| 28 | 28 | { |
| 29 | - $this->assertFileDoesNotExist(sys_get_temp_dir() . '/messages.ru.php'); |
|
| 29 | + $this->assertFileDoesNotExist(sys_get_temp_dir().'/messages.ru.php'); |
|
| 30 | 30 | |
| 31 | 31 | $this->runCommandDebug('i18n:index'); |
| 32 | 32 | $this->runCommandDebug('configure'); |
@@ -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 | |
@@ -41,7 +41,8 @@ discard block |
||
| 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 | 46 | return new Bucket('via-closure', $data); |
| 46 | 47 | }); |
| 47 | 48 | |
@@ -78,7 +79,8 @@ discard block |
||
| 78 | 79 | $sample = new SampleClass(); |
| 79 | 80 | |
| 80 | 81 | $container->bind(Bucket::class, [self::class, 'makeBucketWithSample']); |
| 81 | - $container->bind(SampleClass::class, function () use ($sample) { |
|
| 82 | + $container->bind(SampleClass::class, function () use ($sample) |
|
| 83 | + { |
|
| 82 | 84 | return $sample; |
| 83 | 85 | }); |
| 84 | 86 | |
@@ -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()); |
@@ -27,7 +27,8 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | $this->assertNull(ContainerScope::getContainer()); |
| 29 | 29 | |
| 30 | - $this->assertTrue(ContainerScope::runScope($container, function () use ($container) { |
|
| 30 | + $this->assertTrue(ContainerScope::runScope($container, function () use ($container) |
|
| 31 | + { |
|
| 31 | 32 | return $container === ContainerScope::getContainer(); |
| 32 | 33 | })); |
| 33 | 34 | |
@@ -40,11 +41,14 @@ discard block |
||
| 40 | 41 | |
| 41 | 42 | $this->assertNull(ContainerScope::getContainer()); |
| 42 | 43 | |
| 43 | - try { |
|
| 44 | + try |
|
| 45 | + { |
|
| 44 | 46 | $this->assertTrue(ContainerScope::runScope($container, function () use ($container): void { |
| 45 | 47 | throw new RuntimeException('exception'); |
| 46 | 48 | })); |
| 47 | - } catch (\Throwable $e) { |
|
| 49 | + } |
|
| 50 | + catch (\Throwable $e) |
|
| 51 | + { |
|
| 48 | 52 | } |
| 49 | 53 | |
| 50 | 54 | $this->assertInstanceOf(RuntimeException::class, $e); |
@@ -62,7 +66,8 @@ discard block |
||
| 62 | 66 | $this->assertTrue($c->runScope([ |
| 63 | 67 | 'bucket' => new Bucket('b'), |
| 64 | 68 | 'other' => new SampleClass() |
| 65 | - ], function () use ($c) { |
|
| 69 | + ], function () use ($c) |
|
| 70 | + { |
|
| 66 | 71 | $this->assertSame('b', $c->get('bucket')->getName()); |
| 67 | 72 | $this->assertTrue($c->has('other')); |
| 68 | 73 | |
@@ -84,21 +89,25 @@ discard block |
||
| 84 | 89 | $this->assertTrue($c->runScope([ |
| 85 | 90 | 'bucket' => new Bucket('b'), |
| 86 | 91 | 'other' => new SampleClass() |
| 87 | - ], function () use ($c) { |
|
| 92 | + ], function () use ($c) |
|
| 93 | + { |
|
| 88 | 94 | $this->assertSame('b', $c->get('bucket')->getName()); |
| 89 | 95 | $this->assertTrue($c->has('other')); |
| 90 | 96 | |
| 91 | 97 | return $c->get('bucket')->getName() == 'b' && $c->has('other'); |
| 92 | 98 | })); |
| 93 | 99 | |
| 94 | - try { |
|
| 100 | + try |
|
| 101 | + { |
|
| 95 | 102 | $this->assertTrue($c->runScope([ |
| 96 | 103 | 'bucket' => new Bucket('b'), |
| 97 | 104 | 'other' => new SampleClass() |
| 98 | 105 | ], function () use ($c): void { |
| 99 | 106 | throw new RuntimeException('exception'); |
| 100 | 107 | })); |
| 101 | - } catch (\Throwable $e) { |
|
| 108 | + } |
|
| 109 | + catch (\Throwable $e) |
|
| 110 | + { |
|
| 102 | 111 | } |
| 103 | 112 | |
| 104 | 113 | $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 | |
@@ -60,7 +60,8 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $instance = new SampleClass(); |
| 62 | 62 | |
| 63 | - $container->bindSingleton('sampleClass', function () use ($instance) { |
|
| 63 | + $container->bindSingleton('sampleClass', function () use ($instance) |
|
| 64 | + { |
|
| 64 | 65 | return $instance; |
| 65 | 66 | }); |
| 66 | 67 | |
@@ -71,7 +72,8 @@ discard block |
||
| 71 | 72 | { |
| 72 | 73 | $container = new Container(); |
| 73 | 74 | |
| 74 | - $container->bindSingleton('sampleClass', function () { |
|
| 75 | + $container->bindSingleton('sampleClass', function () |
|
| 76 | + { |
|
| 75 | 77 | return new SampleClass(); |
| 76 | 78 | }); |
| 77 | 79 | |
@@ -98,7 +100,8 @@ discard block |
||
| 98 | 100 | $container = new Container(); |
| 99 | 101 | $container->bindSingleton('singleton', 'sampleClass'); |
| 100 | 102 | |
| 101 | - $container->bind('sampleClass', function () { |
|
| 103 | + $container->bind('sampleClass', function () |
|
| 104 | + { |
|
| 102 | 105 | return new SampleClass(); |
| 103 | 106 | }); |
| 104 | 107 | |
@@ -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) |
@@ -125,7 +125,8 @@ 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 | 130 | return $r->getName() === TestConfig::class; |
| 130 | 131 | }), null) |
| 131 | 132 | ->andReturn($expected) |
@@ -143,7 +144,8 @@ discard block |
||
| 143 | 144 | $container->bind(ConfigsInterface::class, $configurator); |
| 144 | 145 | |
| 145 | 146 | $configurator->shouldReceive('createInjection') |
| 146 | - ->with(m::on(static function (ReflectionClass $r) { |
|
| 147 | + ->with(m::on(static function (ReflectionClass $r) |
|
| 148 | + { |
|
| 147 | 149 | return $r->getName() === TestConfig::class; |
| 148 | 150 | }), 'context') |
| 149 | 151 | ->andReturn($expected) |
@@ -161,7 +163,8 @@ discard block |
||
| 161 | 163 | $container->bind(ConfigsInterface::class, $configurator); |
| 162 | 164 | |
| 163 | 165 | $configurator->shouldReceive('createInjection') |
| 164 | - ->with(m::on(static function (ReflectionClass $r) { |
|
| 166 | + ->with(m::on(static function (ReflectionClass $r) |
|
| 167 | + { |
|
| 165 | 168 | return $r->getName() === TestConfig::class; |
| 166 | 169 | }), 'contextArgument') |
| 167 | 170 | ->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 | |
@@ -25,7 +25,8 @@ 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 | 30 | return 'hello'; |
| 30 | 31 | }); |
| 31 | 32 | |
@@ -38,7 +39,8 @@ discard block |
||
| 38 | 39 | $container = new Container(); |
| 39 | 40 | |
| 40 | 41 | $this->assertFalse($container->has('abc')); |
| 41 | - $container->bind('abc', function () { |
|
| 42 | + $container->bind('abc', function () |
|
| 43 | + { |
|
| 42 | 44 | return 'hello'; |
| 43 | 45 | }); |
| 44 | 46 | |
@@ -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 | } |
@@ -46,11 +46,16 @@ |
||
| 46 | 46 | { |
| 47 | 47 | [$previous, self::$container] = [self::$container, $container]; |
| 48 | 48 | |
| 49 | - try { |
|
| 49 | + try |
|
| 50 | + { |
|
| 50 | 51 | return $scope(); |
| 51 | - } catch (Throwable $e) { |
|
| 52 | + } |
|
| 53 | + catch (Throwable $e) |
|
| 54 | + { |
|
| 52 | 55 | throw $e; |
| 53 | - } finally { |
|
| 56 | + } |
|
| 57 | + finally |
|
| 58 | + { |
|
| 54 | 59 | self::$container = $previous; |
| 55 | 60 | } |
| 56 | 61 | } |