@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs): void |
38 | 38 | { |
39 | 39 | $protoFile = $this->argument('proto'); |
40 | - if (!file_exists($protoFile)) { |
|
40 | + if (!file_exists($protoFile)){ |
|
41 | 41 | $this->sprintf('<error>File `%s` not found.</error>', $protoFile); |
42 | 42 | return; |
43 | 43 | } |
@@ -50,19 +50,19 @@ discard block |
||
50 | 50 | |
51 | 51 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
52 | 52 | |
53 | - try { |
|
53 | + try{ |
|
54 | 54 | $result = $compiler->compile($protoFile); |
55 | - } catch (\Throwable $e) { |
|
55 | + }catch (\Throwable $e){ |
|
56 | 56 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | - if ($result === []) { |
|
60 | + if ($result === []){ |
|
61 | 61 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
62 | 62 | return; |
63 | 63 | } |
64 | 64 | |
65 | - foreach ($result as $file) { |
|
65 | + foreach ($result as $file){ |
|
66 | 66 | $this->sprintf( |
67 | 67 | "<fg=green>•</fg=green> %s%s%s\n", |
68 | 68 | Color::LIGHT_WHITE, |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | protected function getPath(KernelInterface $kernel): string |
82 | 82 | { |
83 | 83 | $path = $this->argument('path'); |
84 | - if ($path !== 'auto') { |
|
84 | + if ($path !== 'auto'){ |
|
85 | 85 | return $path; |
86 | 86 | } |
87 | 87 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | protected function getNamespace(KernelInterface $kernel): string |
100 | 100 | { |
101 | 101 | $namespace = $this->argument('namespace'); |
102 | - if ($namespace !== 'auto') { |
|
102 | + if ($namespace !== 'auto'){ |
|
103 | 103 | return $namespace; |
104 | 104 | } |
105 | 105 |
@@ -37,7 +37,8 @@ discard block |
||
37 | 37 | public function perform(KernelInterface $kernel, FilesInterface $files, DirectoriesInterface $dirs): void |
38 | 38 | { |
39 | 39 | $protoFile = $this->argument('proto'); |
40 | - if (!file_exists($protoFile)) { |
|
40 | + if (!file_exists($protoFile)) |
|
41 | + { |
|
41 | 42 | $this->sprintf('<error>File `%s` not found.</error>', $protoFile); |
42 | 43 | return; |
43 | 44 | } |
@@ -50,19 +51,24 @@ discard block |
||
50 | 51 | |
51 | 52 | $this->sprintf("<info>Compiling <fg=cyan>`%s`</fg=cyan>:</info>\n", $protoFile); |
52 | 53 | |
53 | - try { |
|
54 | + try |
|
55 | + { |
|
54 | 56 | $result = $compiler->compile($protoFile); |
55 | - } catch (\Throwable $e) { |
|
57 | + } |
|
58 | + catch (\Throwable $e) |
|
59 | + { |
|
56 | 60 | $this->sprintf("<error>Error:</error> <fg=red>%s</fg=red>\n", $e->getMessage()); |
57 | 61 | return; |
58 | 62 | } |
59 | 63 | |
60 | - if ($result === []) { |
|
64 | + if ($result === []) |
|
65 | + { |
|
61 | 66 | $this->sprintf("<info>No files were generated.</info>\n", $protoFile); |
62 | 67 | return; |
63 | 68 | } |
64 | 69 | |
65 | - foreach ($result as $file) { |
|
70 | + foreach ($result as $file) |
|
71 | + { |
|
66 | 72 | $this->sprintf( |
67 | 73 | "<fg=green>•</fg=green> %s%s%s\n", |
68 | 74 | Color::LIGHT_WHITE, |
@@ -81,7 +87,8 @@ discard block |
||
81 | 87 | protected function getPath(KernelInterface $kernel): string |
82 | 88 | { |
83 | 89 | $path = $this->argument('path'); |
84 | - if ($path !== 'auto') { |
|
90 | + if ($path !== 'auto') |
|
91 | + { |
|
85 | 92 | return $path; |
86 | 93 | } |
87 | 94 | |
@@ -99,7 +106,8 @@ discard block |
||
99 | 106 | protected function getNamespace(KernelInterface $kernel): string |
100 | 107 | { |
101 | 108 | $namespace = $this->argument('namespace'); |
102 | - if ($namespace !== 'auto') { |
|
109 | + if ($namespace !== 'auto') |
|
110 | + { |
|
103 | 111 | return $namespace; |
104 | 112 | } |
105 | 113 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | use Spiral\Core\Container\Autowire; |
13 | 13 | use Spiral\Debug\Dumper; |
14 | 14 | |
15 | -if (!function_exists('bind')) { |
|
15 | +if (!function_exists('bind')){ |
|
16 | 16 | /** |
17 | 17 | * Shortcut to container Autowire definition. |
18 | 18 | * |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if (!function_exists('dumprr')) { |
|
33 | +if (!function_exists('dumprr')){ |
|
34 | 34 | /** |
35 | 35 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
36 | 36 | * |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | use Spiral\Core\Container\Autowire; |
13 | 13 | use Spiral\Debug\Dumper; |
14 | 14 | |
15 | -if (!function_exists('bind')) { |
|
15 | +if (!function_exists('bind')) |
|
16 | +{ |
|
16 | 17 | /** |
17 | 18 | * Shortcut to container Autowire definition. |
18 | 19 | * |
@@ -30,7 +31,8 @@ discard block |
||
30 | 31 | } |
31 | 32 | } |
32 | 33 | |
33 | -if (!function_exists('dumprr')) { |
|
34 | +if (!function_exists('dumprr')) |
|
35 | +{ |
|
34 | 36 | /** |
35 | 37 | * Dumprr is similar to Dump function but always redirect output to STDERR. |
36 | 38 | * |
@@ -38,15 +38,15 @@ |
||
38 | 38 | public function getServices(): array |
39 | 39 | { |
40 | 40 | $result = []; |
41 | - foreach ($this->classes->getClasses(ServiceInterface::class) as $service) { |
|
42 | - if (!$service->isInstantiable()) { |
|
41 | + foreach ($this->classes->getClasses(ServiceInterface::class) as $service){ |
|
42 | + if (!$service->isInstantiable()){ |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | |
46 | 46 | $instance = $this->container->get($service->getName()); |
47 | 47 | |
48 | - foreach ($service->getInterfaces() as $interface) { |
|
49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
48 | + foreach ($service->getInterfaces() as $interface){ |
|
49 | + if ($interface->isSubclassOf(ServiceInterface::class)){ |
|
50 | 50 | $result[$interface->getName()] = $instance; |
51 | 51 | } |
52 | 52 | } |
@@ -38,15 +38,19 @@ |
||
38 | 38 | public function getServices(): array |
39 | 39 | { |
40 | 40 | $result = []; |
41 | - foreach ($this->classes->getClasses(ServiceInterface::class) as $service) { |
|
42 | - if (!$service->isInstantiable()) { |
|
41 | + foreach ($this->classes->getClasses(ServiceInterface::class) as $service) |
|
42 | + { |
|
43 | + if (!$service->isInstantiable()) |
|
44 | + { |
|
43 | 45 | continue; |
44 | 46 | } |
45 | 47 | |
46 | 48 | $instance = $this->container->get($service->getName()); |
47 | 49 | |
48 | - foreach ($service->getInterfaces() as $interface) { |
|
49 | - if ($interface->isSubclassOf(ServiceInterface::class)) { |
|
50 | + foreach ($service->getInterfaces() as $interface) |
|
51 | + { |
|
52 | + if ($interface->isSubclassOf(ServiceInterface::class)) |
|
53 | + { |
|
50 | 54 | $result[$interface->getName()] = $instance; |
51 | 55 | } |
52 | 56 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | EnvironmentInterface $env, |
40 | 40 | FinalizerInterface $finalizer, |
41 | 41 | ContainerInterface $container |
42 | - ) { |
|
42 | + ){ |
|
43 | 43 | $this->env = $env; |
44 | 44 | $this->finalizer = $finalizer; |
45 | 45 | $this->container = $container; |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | $worker = $this->container->get(Worker::class); |
70 | 70 | $locator = $this->container->get(LocatorInterface::class); |
71 | 71 | |
72 | - foreach ($locator->getServices() as $interface => $service) { |
|
72 | + foreach ($locator->getServices() as $interface => $service){ |
|
73 | 73 | $server->registerService($interface, $service); |
74 | 74 | } |
75 | 75 | |
76 | 76 | $server->serve( |
77 | 77 | $worker, |
78 | 78 | function (\Throwable $e = null): void { |
79 | - if ($e !== null) { |
|
79 | + if ($e !== null){ |
|
80 | 80 | $this->handleException($e); |
81 | 81 | } |
82 | 82 | |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | */ |
91 | 91 | protected function handleException(\Throwable $e): void |
92 | 92 | { |
93 | - try { |
|
93 | + try{ |
|
94 | 94 | $this->container->get(SnapshotterInterface::class)->register($e); |
95 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
95 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
96 | 96 | // no need to notify when unable to register an exception |
97 | 97 | } |
98 | 98 | } |
@@ -69,14 +69,16 @@ discard block |
||
69 | 69 | $worker = $this->container->get(Worker::class); |
70 | 70 | $locator = $this->container->get(LocatorInterface::class); |
71 | 71 | |
72 | - foreach ($locator->getServices() as $interface => $service) { |
|
72 | + foreach ($locator->getServices() as $interface => $service) |
|
73 | + { |
|
73 | 74 | $server->registerService($interface, $service); |
74 | 75 | } |
75 | 76 | |
76 | 77 | $server->serve( |
77 | 78 | $worker, |
78 | 79 | function (\Throwable $e = null): void { |
79 | - if ($e !== null) { |
|
80 | + if ($e !== null) |
|
81 | + { |
|
80 | 82 | $this->handleException($e); |
81 | 83 | } |
82 | 84 | |
@@ -90,9 +92,12 @@ discard block |
||
90 | 92 | */ |
91 | 93 | protected function handleException(\Throwable $e): void |
92 | 94 | { |
93 | - try { |
|
95 | + try |
|
96 | + { |
|
94 | 97 | $this->container->get(SnapshotterInterface::class)->register($e); |
95 | - } catch (\Throwable | ContainerExceptionInterface $se) { |
|
98 | + } |
|
99 | + catch (\Throwable | ContainerExceptionInterface $se) |
|
100 | + { |
|
96 | 101 | // no need to notify when unable to register an exception |
97 | 102 | } |
98 | 103 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | public function compile(string $path, ContextInterface $context): void |
34 | 34 | { |
35 | - if ($path === 'custom:error') { |
|
35 | + if ($path === 'custom:error'){ |
|
36 | 36 | throw new EngineException('Unable to compile custom:error'); |
37 | 37 | } |
38 | 38 | } |
@@ -32,7 +32,8 @@ |
||
32 | 32 | |
33 | 33 | public function compile(string $path, ContextInterface $context): void |
34 | 34 | { |
35 | - if ($path === 'custom:error') { |
|
35 | + if ($path === 'custom:error') |
|
36 | + { |
|
36 | 37 | throw new EngineException('Unable to compile custom:error'); |
37 | 38 | } |
38 | 39 | } |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | { |
37 | 37 | exec('protoc 2>&1', $out); |
38 | 38 | |
39 | - if (strpos(implode("\n", $out), '--php_out') === false) { |
|
39 | + if (strpos(implode("\n", $out), '--php_out') === false){ |
|
40 | 40 | $this->markTestSkipped('Protoc binary is missing'); |
41 | 41 | } |
42 | 42 | |
43 | 43 | parent::setUp(); |
44 | 44 | |
45 | 45 | $fs = new Files(); |
46 | - $this->proto = \realpath($fs->normalizePath($this->app->dir('app') . 'proto/service.proto')); |
|
46 | + $this->proto = \realpath($fs->normalizePath($this->app->dir('app').'proto/service.proto')); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function tearDown(): void |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | |
53 | 53 | $fs = new Files(); |
54 | 54 | |
55 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
56 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
55 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
56 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
57 | 57 | } |
58 | 58 | |
59 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
60 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
59 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
60 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | 'proto' => $this->proto |
86 | 86 | ]); |
87 | 87 | |
88 | - $this->assertFileExists($this->app->dir('app') . 'src/Service/EchoInterface.php'); |
|
89 | - $this->assertFileExists($this->app->dir('app') . 'src/Service/Sub/Message.php'); |
|
90 | - $this->assertFileExists($this->app->dir('app') . 'src/GPBMetadata/Service.php'); |
|
88 | + $this->assertFileExists($this->app->dir('app').'src/Service/EchoInterface.php'); |
|
89 | + $this->assertFileExists($this->app->dir('app').'src/Service/Sub/Message.php'); |
|
90 | + $this->assertFileExists($this->app->dir('app').'src/GPBMetadata/Service.php'); |
|
91 | 91 | } |
92 | 92 | } |
@@ -36,7 +36,8 @@ discard block |
||
36 | 36 | { |
37 | 37 | exec('protoc 2>&1', $out); |
38 | 38 | |
39 | - if (strpos(implode("\n", $out), '--php_out') === false) { |
|
39 | + if (strpos(implode("\n", $out), '--php_out') === false) |
|
40 | + { |
|
40 | 41 | $this->markTestSkipped('Protoc binary is missing'); |
41 | 42 | } |
42 | 43 | |
@@ -52,11 +53,13 @@ discard block |
||
52 | 53 | |
53 | 54 | $fs = new Files(); |
54 | 55 | |
55 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
56 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
57 | + { |
|
56 | 58 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
57 | 59 | } |
58 | 60 | |
59 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
61 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
62 | + { |
|
60 | 63 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
61 | 64 | } |
62 | 65 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function setUp(): void |
24 | 24 | { |
25 | 25 | exec('protoc 2>&1', $out); |
26 | - if (strpos(implode("\n", $out), '--php_out') === false) { |
|
26 | + if (strpos(implode("\n", $out), '--php_out') === false){ |
|
27 | 27 | $this->markTestSkipped('Protoc binary is missing'); |
28 | 28 | } |
29 | 29 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $fs = new Files(); |
33 | 33 | |
34 | 34 | $this->runCommandDebug('grpc:generate', [ |
35 | - 'proto' => realpath($fs->normalizePath($this->app->dir('app') . 'proto/service.proto')) |
|
35 | + 'proto' => realpath($fs->normalizePath($this->app->dir('app').'proto/service.proto')) |
|
36 | 36 | ]); |
37 | 37 | |
38 | - $output = $this->app->dir('app') . 'src/Service/EchoService.php'; |
|
38 | + $output = $this->app->dir('app').'src/Service/EchoService.php'; |
|
39 | 39 | file_put_contents($output, GenerateTest::SERVICE); |
40 | 40 | } |
41 | 41 | |
@@ -45,12 +45,12 @@ discard block |
||
45 | 45 | |
46 | 46 | $fs = new Files(); |
47 | 47 | |
48 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
49 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
48 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
49 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
50 | 50 | } |
51 | 51 | |
52 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
53 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
52 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
53 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $msg->setMsg('hello'); |
77 | 77 | |
78 | 78 | $w->shouldReceive('receive')->once()->with( |
79 | - \Mockery::on(function (&$context) { |
|
79 | + \Mockery::on(function (&$context){ |
|
80 | 80 | $context = '{ |
81 | 81 | "service": "service.Echo", |
82 | 82 | "method": "Ping", |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | )->andReturn($msg->serializeToString()); |
89 | 89 | |
90 | 90 | $w->shouldReceive('send')->once()->with( |
91 | - \Mockery::on(function ($out) { |
|
91 | + \Mockery::on(function ($out){ |
|
92 | 92 | $msg = new Message(); |
93 | 93 | $msg->mergeFromString($out); |
94 | 94 | $this->assertSame('hello', $msg->getMsg()); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | // one command only |
102 | 102 | $w->shouldReceive('receive')->once()->with( |
103 | - \Mockery::on(function (&$context) { |
|
103 | + \Mockery::on(function (&$context){ |
|
104 | 104 | $context = null; |
105 | 105 | return true; |
106 | 106 | }) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $msg->setMsg('hello'); |
121 | 121 | |
122 | 122 | $w->shouldReceive('receive')->once()->with( |
123 | - \Mockery::on(function (&$context) { |
|
123 | + \Mockery::on(function (&$context){ |
|
124 | 124 | $context = '{ |
125 | 125 | "service": "service.Echo", |
126 | 126 | "method": "Invalid", |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | )->andReturn($msg->serializeToString()); |
133 | 133 | |
134 | 134 | $w->shouldReceive('error')->once()->with( |
135 | - \Mockery::on(function ($out) { |
|
135 | + \Mockery::on(function ($out){ |
|
136 | 136 | $this->assertStringContainsString('Method `Invalid` not found', $out); |
137 | 137 | return true; |
138 | 138 | }) |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | // one command only |
142 | 142 | $w->shouldReceive('receive')->once()->with( |
143 | - \Mockery::on(function (&$context) { |
|
143 | + \Mockery::on(function (&$context){ |
|
144 | 144 | $context = null; |
145 | 145 | return true; |
146 | 146 | }) |
@@ -23,7 +23,8 @@ discard block |
||
23 | 23 | public function setUp(): void |
24 | 24 | { |
25 | 25 | exec('protoc 2>&1', $out); |
26 | - if (strpos(implode("\n", $out), '--php_out') === false) { |
|
26 | + if (strpos(implode("\n", $out), '--php_out') === false) |
|
27 | + { |
|
27 | 28 | $this->markTestSkipped('Protoc binary is missing'); |
28 | 29 | } |
29 | 30 | |
@@ -45,11 +46,13 @@ discard block |
||
45 | 46 | |
46 | 47 | $fs = new Files(); |
47 | 48 | |
48 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
49 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
50 | + { |
|
49 | 51 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
50 | 52 | } |
51 | 53 | |
52 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
54 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
55 | + { |
|
53 | 56 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
54 | 57 | } |
55 | 58 | } |
@@ -76,7 +79,8 @@ discard block |
||
76 | 79 | $msg->setMsg('hello'); |
77 | 80 | |
78 | 81 | $w->shouldReceive('receive')->once()->with( |
79 | - \Mockery::on(function (&$context) { |
|
82 | + \Mockery::on(function (&$context) |
|
83 | + { |
|
80 | 84 | $context = '{ |
81 | 85 | "service": "service.Echo", |
82 | 86 | "method": "Ping", |
@@ -88,7 +92,8 @@ discard block |
||
88 | 92 | )->andReturn($msg->serializeToString()); |
89 | 93 | |
90 | 94 | $w->shouldReceive('send')->once()->with( |
91 | - \Mockery::on(function ($out) { |
|
95 | + \Mockery::on(function ($out) |
|
96 | + { |
|
92 | 97 | $msg = new Message(); |
93 | 98 | $msg->mergeFromString($out); |
94 | 99 | $this->assertSame('hello', $msg->getMsg()); |
@@ -100,7 +105,8 @@ discard block |
||
100 | 105 | |
101 | 106 | // one command only |
102 | 107 | $w->shouldReceive('receive')->once()->with( |
103 | - \Mockery::on(function (&$context) { |
|
108 | + \Mockery::on(function (&$context) |
|
109 | + { |
|
104 | 110 | $context = null; |
105 | 111 | return true; |
106 | 112 | }) |
@@ -120,7 +126,8 @@ discard block |
||
120 | 126 | $msg->setMsg('hello'); |
121 | 127 | |
122 | 128 | $w->shouldReceive('receive')->once()->with( |
123 | - \Mockery::on(function (&$context) { |
|
129 | + \Mockery::on(function (&$context) |
|
130 | + { |
|
124 | 131 | $context = '{ |
125 | 132 | "service": "service.Echo", |
126 | 133 | "method": "Invalid", |
@@ -132,7 +139,8 @@ discard block |
||
132 | 139 | )->andReturn($msg->serializeToString()); |
133 | 140 | |
134 | 141 | $w->shouldReceive('error')->once()->with( |
135 | - \Mockery::on(function ($out) { |
|
142 | + \Mockery::on(function ($out) |
|
143 | + { |
|
136 | 144 | $this->assertStringContainsString('Method `Invalid` not found', $out); |
137 | 145 | return true; |
138 | 146 | }) |
@@ -140,7 +148,8 @@ discard block |
||
140 | 148 | |
141 | 149 | // one command only |
142 | 150 | $w->shouldReceive('receive')->once()->with( |
143 | - \Mockery::on(function (&$context) { |
|
151 | + \Mockery::on(function (&$context) |
|
152 | + { |
|
144 | 153 | $context = null; |
145 | 154 | return true; |
146 | 155 | }) |
@@ -36,11 +36,11 @@ |
||
36 | 36 | */ |
37 | 37 | public function loadFile(string $section, string $filename): array |
38 | 38 | { |
39 | - try { |
|
39 | + try{ |
|
40 | 40 | return ContainerScope::runScope($this->container, function () use ($filename) { |
41 | 41 | return (require $filename); |
42 | 42 | }); |
43 | - } catch (\Throwable $e) { |
|
43 | + }catch (\Throwable $e){ |
|
44 | 44 | throw new LoaderException($e->getMessage(), $e->getCode(), $e); |
45 | 45 | } |
46 | 46 | } |
@@ -36,11 +36,15 @@ |
||
36 | 36 | */ |
37 | 37 | public function loadFile(string $section, string $filename): array |
38 | 38 | { |
39 | - try { |
|
40 | - return ContainerScope::runScope($this->container, function () use ($filename) { |
|
39 | + try |
|
40 | + { |
|
41 | + return ContainerScope::runScope($this->container, function () use ($filename) |
|
42 | + { |
|
41 | 43 | return (require $filename); |
42 | 44 | }); |
43 | - } catch (\Throwable $e) { |
|
45 | + } |
|
46 | + catch (\Throwable $e) |
|
47 | + { |
|
44 | 48 | throw new LoaderException($e->getMessage(), $e->getCode(), $e); |
45 | 49 | } |
46 | 50 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $content = file_get_contents($filename); |
24 | 24 | $data = json_decode($content, true); |
25 | 25 | |
26 | - if (is_null($data)) { |
|
26 | + if (is_null($data)){ |
|
27 | 27 | throw new LoaderException(json_last_error_msg(), json_last_error()); |
28 | 28 | } |
29 | 29 |
@@ -23,7 +23,8 @@ |
||
23 | 23 | $content = file_get_contents($filename); |
24 | 24 | $data = json_decode($content, true); |
25 | 25 | |
26 | - if (is_null($data)) { |
|
26 | + if (is_null($data)) |
|
27 | + { |
|
27 | 28 | throw new LoaderException(json_last_error_msg(), json_last_error()); |
28 | 29 | } |
29 | 30 |