@@ -9,4 +9,4 @@ |
||
9 | 9 | ini_set('display_errors', true); |
10 | 10 | |
11 | 11 | //Composer |
12 | -require dirname(__DIR__) . '/vendor/autoload.php'; |
|
12 | +require dirname(__DIR__).'/vendor/autoload.php'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | public function testMountFileNotFound() |
24 | 24 | { |
25 | 25 | $out = $this->runCommand('encrypt:key', [ |
26 | - '-m' => __DIR__ . '/.env' |
|
26 | + '-m' => __DIR__.'/.env' |
|
27 | 27 | ]); |
28 | 28 | |
29 | 29 | $this->assertContains('Unable to find', $out); |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | |
32 | 32 | public function testReplace() |
33 | 33 | { |
34 | - file_put_contents(__DIR__ . '/.env', '{encrypt-key}'); |
|
34 | + file_put_contents(__DIR__.'/.env', '{encrypt-key}'); |
|
35 | 35 | |
36 | 36 | $out = $this->runCommand('encrypt:key', [ |
37 | - '-m' => __DIR__ . '/.env' |
|
37 | + '-m' => __DIR__.'/.env' |
|
38 | 38 | ]); |
39 | 39 | |
40 | 40 | $this->assertContains('key has been updated', $out); |
41 | 41 | |
42 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
42 | + $body = file_get_contents(__DIR__.'/.env'); |
|
43 | 43 | $this->assertContains($body, $out); |
44 | 44 | |
45 | - unlink(__DIR__ . '/.env'); |
|
45 | + unlink(__DIR__.'/.env'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | public function testReplaceCurrent() |
@@ -53,18 +53,18 @@ discard block |
||
53 | 53 | 'ENCRYPTER_KEY' => $key |
54 | 54 | ]); |
55 | 55 | |
56 | - file_put_contents(__DIR__ . '/.env', $key); |
|
56 | + file_put_contents(__DIR__.'/.env', $key); |
|
57 | 57 | |
58 | 58 | $out = $app->console()->run('encrypt:key', [ |
59 | - '-m' => __DIR__ . '/.env' |
|
59 | + '-m' => __DIR__.'/.env' |
|
60 | 60 | ]); |
61 | 61 | $out = $out->getOutput()->fetch(); |
62 | 62 | |
63 | 63 | $this->assertContains('key has been updated', $out); |
64 | 64 | |
65 | - $body = file_get_contents(__DIR__ . '/.env'); |
|
65 | + $body = file_get_contents(__DIR__.'/.env'); |
|
66 | 66 | $this->assertContains($body, $out); |
67 | 67 | |
68 | - unlink(__DIR__ . '/.env'); |
|
68 | + unlink(__DIR__.'/.env'); |
|
69 | 69 | } |
70 | 70 | } |
@@ -21,14 +21,14 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | exec('protoc 2>&1', $out); |
24 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
24 | + if (strpos(join("\n", $out), '--php_out') === false){ |
|
25 | 25 | $this->markTestSkipped('Protoc binary is missing'); |
26 | 26 | } |
27 | 27 | |
28 | 28 | parent::setUp(); |
29 | 29 | |
30 | 30 | $fs = new Files(); |
31 | - $proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
31 | + $proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
32 | 32 | |
33 | 33 | // protoc can't figure relative paths |
34 | 34 | $proto = str_replace('Framework/../', '', $proto); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'proto' => $proto |
38 | 38 | ]); |
39 | 39 | |
40 | - file_put_contents($this->app->dir('app') . 'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
40 | + file_put_contents($this->app->dir('app').'src/Service/EchoService.php', GenerateTest::SERVICE); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | public function tearDown() |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | |
47 | 47 | $fs = new Files(); |
48 | 48 | |
49 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
50 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
49 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
50 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
51 | 51 | } |
52 | 52 | |
53 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
54 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
53 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
54 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $msg->setMsg("hello"); |
78 | 78 | |
79 | 79 | $w->shouldReceive('receive')->once()->with( |
80 | - \Mockery::on(function (&$context) { |
|
80 | + \Mockery::on(function (&$context){ |
|
81 | 81 | $context = '{ |
82 | 82 | "service": "service.Echo", |
83 | 83 | "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()); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | // one command only |
101 | 101 | $w->shouldReceive('receive')->once()->with( |
102 | - \Mockery::on(function (&$context) { |
|
102 | + \Mockery::on(function (&$context){ |
|
103 | 103 | $context = null; |
104 | 104 | return true; |
105 | 105 | }) |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $msg->setMsg("hello"); |
120 | 120 | |
121 | 121 | $w->shouldReceive('receive')->once()->with( |
122 | - \Mockery::on(function (&$context) { |
|
122 | + \Mockery::on(function (&$context){ |
|
123 | 123 | $context = '{ |
124 | 124 | "service": "service.Echo", |
125 | 125 | "method": "Invalid" |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | )->andReturn($msg->serializeToString()); |
131 | 131 | |
132 | 132 | $w->shouldReceive('error')->once()->with( |
133 | - \Mockery::on(function ($out) { |
|
133 | + \Mockery::on(function ($out){ |
|
134 | 134 | $this->assertContains('Method `Invalid` not found', $out); |
135 | 135 | return true; |
136 | 136 | }) |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | // one command only |
140 | 140 | $w->shouldReceive('receive')->once()->with( |
141 | - \Mockery::on(function (&$context) { |
|
141 | + \Mockery::on(function (&$context){ |
|
142 | 142 | $context = null; |
143 | 143 | return true; |
144 | 144 | }) |
@@ -21,7 +21,8 @@ discard block |
||
21 | 21 | public function setUp() |
22 | 22 | { |
23 | 23 | exec('protoc 2>&1', $out); |
24 | - if (strpos(join("\n", $out), '--php_out') === false) { |
|
24 | + if (strpos(join("\n", $out), '--php_out') === false) |
|
25 | + { |
|
25 | 26 | $this->markTestSkipped('Protoc binary is missing'); |
26 | 27 | } |
27 | 28 | |
@@ -46,11 +47,13 @@ discard block |
||
46 | 47 | |
47 | 48 | $fs = new Files(); |
48 | 49 | |
49 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
50 | + if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) |
|
51 | + { |
|
50 | 52 | $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
51 | 53 | } |
52 | 54 | |
53 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
55 | + if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) |
|
56 | + { |
|
54 | 57 | $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
55 | 58 | } |
56 | 59 | } |
@@ -77,7 +80,8 @@ discard block |
||
77 | 80 | $msg->setMsg("hello"); |
78 | 81 | |
79 | 82 | $w->shouldReceive('receive')->once()->with( |
80 | - \Mockery::on(function (&$context) { |
|
83 | + \Mockery::on(function (&$context) |
|
84 | + { |
|
81 | 85 | $context = '{ |
82 | 86 | "service": "service.Echo", |
83 | 87 | "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()); |
@@ -99,7 +104,8 @@ discard block |
||
99 | 104 | |
100 | 105 | // one command only |
101 | 106 | $w->shouldReceive('receive')->once()->with( |
102 | - \Mockery::on(function (&$context) { |
|
107 | + \Mockery::on(function (&$context) |
|
108 | + { |
|
103 | 109 | $context = null; |
104 | 110 | return true; |
105 | 111 | }) |
@@ -119,7 +125,8 @@ discard block |
||
119 | 125 | $msg->setMsg("hello"); |
120 | 126 | |
121 | 127 | $w->shouldReceive('receive')->once()->with( |
122 | - \Mockery::on(function (&$context) { |
|
128 | + \Mockery::on(function (&$context) |
|
129 | + { |
|
123 | 130 | $context = '{ |
124 | 131 | "service": "service.Echo", |
125 | 132 | "method": "Invalid" |
@@ -130,7 +137,8 @@ discard block |
||
130 | 137 | )->andReturn($msg->serializeToString()); |
131 | 138 | |
132 | 139 | $w->shouldReceive('error')->once()->with( |
133 | - \Mockery::on(function ($out) { |
|
140 | + \Mockery::on(function ($out) |
|
141 | + { |
|
134 | 142 | $this->assertContains('Method `Invalid` not found', $out); |
135 | 143 | return true; |
136 | 144 | }) |
@@ -138,7 +146,8 @@ discard block |
||
138 | 146 | |
139 | 147 | // one command only |
140 | 148 | $w->shouldReceive('receive')->once()->with( |
141 | - \Mockery::on(function (&$context) { |
|
149 | + \Mockery::on(function (&$context) |
|
150 | + { |
|
142 | 151 | $context = null; |
143 | 152 | return true; |
144 | 153 | }) |
@@ -17,10 +17,10 @@ |
||
17 | 17 | public function makeApp(array $env = []): TestApp |
18 | 18 | { |
19 | 19 | return TestApp::init([ |
20 | - 'root' => __DIR__ . '/../..', |
|
21 | - 'app' => __DIR__ . '/../app', |
|
22 | - 'runtime' => sys_get_temp_dir() . '/spiral', |
|
23 | - 'cache' => sys_get_temp_dir() . '/spiral', |
|
20 | + 'root' => __DIR__.'/../..', |
|
21 | + 'app' => __DIR__.'/../app', |
|
22 | + 'runtime' => sys_get_temp_dir().'/spiral', |
|
23 | + 'cache' => sys_get_temp_dir().'/spiral', |
|
24 | 24 | ], new Environment($env), false); |
25 | 25 | } |
26 | 26 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | public function testReset() |
17 | 17 | { |
18 | - $this->assertFileNotExists(__DIR__ . '/messages.ru.php'); |
|
18 | + $this->assertFileNotExists(__DIR__.'/messages.ru.php'); |
|
19 | 19 | |
20 | 20 | $this->runCommandDebug('i18n:index'); |
21 | 21 | $this->runCommandDebug('configure'); |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | '--fallback' => 'en', |
26 | 26 | ]); |
27 | 27 | |
28 | - $this->assertFileExists(__DIR__ . '/messages.ru.php'); |
|
28 | + $this->assertFileExists(__DIR__.'/messages.ru.php'); |
|
29 | 29 | |
30 | - $exp = (require __DIR__ . '/messages.ru.php'); |
|
30 | + $exp = (require __DIR__.'/messages.ru.php'); |
|
31 | 31 | |
32 | 32 | $this->assertArrayHasKey('World', $exp); |
33 | 33 | $this->assertSame('Мир', $exp['World']); |
@@ -35,6 +35,6 @@ discard block |
||
35 | 35 | $this->assertArrayHasKey('%s unit|%s units', $exp); |
36 | 36 | $this->assertArrayHasKey('This value is required.', $exp); |
37 | 37 | |
38 | - unlink(__DIR__ . '/messages.ru.php'); |
|
38 | + unlink(__DIR__.'/messages.ru.php'); |
|
39 | 39 | } |
40 | 40 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $e = $this->bufferEmitter; |
58 | 58 | |
59 | 59 | $files = $this->app->get(FilesInterface::class)->getFiles( |
60 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
60 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | $this->assertCount(0, $files); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->app->get(SapiDispatcher::class)->serve($e); |
67 | 67 | |
68 | 68 | $files = $this->app->get(FilesInterface::class)->getFiles( |
69 | - $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
69 | + $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $this->assertCount(1, $files); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | ]); |
84 | 84 | |
85 | 85 | $files = $app->get(FilesInterface::class)->getFiles( |
86 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
86 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
87 | 87 | ); |
88 | 88 | |
89 | 89 | $this->assertCount(0, $files); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $app->get(SapiDispatcher::class)->serve($e); |
93 | 93 | |
94 | 94 | $files = $app->get(FilesInterface::class)->getFiles( |
95 | - $app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/' |
|
95 | + $app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/' |
|
96 | 96 | ); |
97 | 97 | |
98 | 98 | $this->assertCount(1, $files); |
@@ -27,9 +27,9 @@ |
||
27 | 27 | */ |
28 | 28 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
29 | 29 | { |
30 | - if ($this->isJsonPayload($request)) { |
|
30 | + if ($this->isJsonPayload($request)){ |
|
31 | 31 | $request = $request->withParsedBody(json_decode($request->getBody()->getContents(), true)); |
32 | - if (json_last_error() !== 0) { |
|
32 | + if (json_last_error() !== 0){ |
|
33 | 33 | throw new ClientException(400, 'invalid json payload'); |
34 | 34 | } |
35 | 35 | } |
@@ -27,9 +27,11 @@ |
||
27 | 27 | */ |
28 | 28 | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface |
29 | 29 | { |
30 | - if ($this->isJsonPayload($request)) { |
|
30 | + if ($this->isJsonPayload($request)) |
|
31 | + { |
|
31 | 32 | $request = $request->withParsedBody(json_decode($request->getBody()->getContents(), true)); |
32 | - if (json_last_error() !== 0) { |
|
33 | + if (json_last_error() !== 0) |
|
34 | + { |
|
33 | 35 | throw new ClientException(400, 'invalid json payload'); |
34 | 36 | } |
35 | 37 | } |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class){ |
|
41 | + if ($class->isAbstract()){ |
|
42 | 42 | continue; |
43 | 43 | } |
44 | 44 |
@@ -37,8 +37,10 @@ |
||
37 | 37 | public function locateCommands(): array |
38 | 38 | { |
39 | 39 | $commands = []; |
40 | - foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) { |
|
41 | - if ($class->isAbstract()) { |
|
40 | + foreach ($this->classes->getClasses(SymfonyCommand::class) as $class) |
|
41 | + { |
|
42 | + if ($class->isAbstract()) |
|
43 | + { |
|
42 | 44 | continue; |
43 | 45 | } |
44 | 46 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | EnvironmentInterface $env, |
38 | 38 | FinalizerInterface $finalizer, |
39 | 39 | ContainerInterface $container |
40 | - ) { |
|
40 | + ){ |
|
41 | 41 | $this->env = $env; |
42 | 42 | $this->finalizer = $finalizer; |
43 | 43 | $this->container = $container; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $consumer = $this->container->get(Consumer::class); |
64 | 64 | $worker = $this->container->get(Worker::class); |
65 | 65 | |
66 | - $consumer->serve($worker, function (\Throwable $e = null) { |
|
67 | - if ($e !== null) { |
|
66 | + $consumer->serve($worker, function (\Throwable $e = null){ |
|
67 | + if ($e !== null){ |
|
68 | 68 | $this->handleException($e); |
69 | 69 | } |
70 | 70 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | protected function handleException(\Throwable $e) |
79 | 79 | { |
80 | - try { |
|
80 | + try{ |
|
81 | 81 | $this->container->get(SnapshotterInterface::class)->register($e); |
82 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
82 | + }catch (\Throwable | ContainerExceptionInterface $se){ |
|
83 | 83 | // no need to notify when unable to register an exception |
84 | 84 | } |
85 | 85 | } |
@@ -63,8 +63,10 @@ discard block |
||
63 | 63 | $consumer = $this->container->get(Consumer::class); |
64 | 64 | $worker = $this->container->get(Worker::class); |
65 | 65 | |
66 | - $consumer->serve($worker, function (\Throwable $e = null) { |
|
67 | - if ($e !== null) { |
|
66 | + $consumer->serve($worker, function (\Throwable $e = null) |
|
67 | + { |
|
68 | + if ($e !== null) |
|
69 | + { |
|
68 | 70 | $this->handleException($e); |
69 | 71 | } |
70 | 72 | |
@@ -77,9 +79,12 @@ discard block |
||
77 | 79 | */ |
78 | 80 | protected function handleException(\Throwable $e) |
79 | 81 | { |
80 | - try { |
|
82 | + try |
|
83 | + { |
|
81 | 84 | $this->container->get(SnapshotterInterface::class)->register($e); |
82 | - } catch (\Throwable|ContainerExceptionInterface $se) { |
|
85 | + } |
|
86 | + catch (\Throwable|ContainerExceptionInterface $se) |
|
87 | + { |
|
83 | 88 | // no need to notify when unable to register an exception |
84 | 89 | } |
85 | 90 | } |