@@ -27,20 +27,20 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files) |
29 | 29 | { |
30 | - if (!$files->exists($config->getCacheDirectory())) { |
|
30 | + if (!$files->exists($config->getCacheDirectory())){ |
|
31 | 31 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
32 | 32 | |
33 | 33 | return; |
34 | 34 | } |
35 | 35 | |
36 | - if ($this->isVerbose()) { |
|
36 | + if ($this->isVerbose()){ |
|
37 | 37 | $this->writeln("<info>Cleaning view cache:</info>"); |
38 | 38 | } |
39 | 39 | |
40 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
41 | - try { |
|
40 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename){ |
|
41 | + try{ |
|
42 | 42 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
43 | + }catch (\Throwable $e){ |
|
44 | 44 | // @codeCoverageIgnoreStart |
45 | 45 | $this->sprintf( |
46 | 46 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | // @codeCoverageIgnoreEnd |
54 | 54 | } |
55 | 55 | |
56 | - if ($this->isVerbose()) { |
|
56 | + if ($this->isVerbose()){ |
|
57 | 57 | $this->sprintf( |
58 | 58 | "<fg=green>[deleted]</fg=green> `%s`\n", |
59 | 59 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -27,20 +27,26 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function perform(ViewsConfig $config, FilesInterface $files) |
29 | 29 | { |
30 | - if (!$files->exists($config->getCacheDirectory())) { |
|
30 | + if (!$files->exists($config->getCacheDirectory())) |
|
31 | + { |
|
31 | 32 | $this->writeln("Cache directory is missing, no cache to be cleaned."); |
32 | 33 | |
33 | 34 | return; |
34 | 35 | } |
35 | 36 | |
36 | - if ($this->isVerbose()) { |
|
37 | + if ($this->isVerbose()) |
|
38 | + { |
|
37 | 39 | $this->writeln("<info>Cleaning view cache:</info>"); |
38 | 40 | } |
39 | 41 | |
40 | - foreach ($files->getFiles($config->getCacheDirectory()) as $filename) { |
|
41 | - try { |
|
42 | + foreach ($files->getFiles($config->getCacheDirectory()) as $filename) |
|
43 | + { |
|
44 | + try |
|
45 | + { |
|
42 | 46 | $files->delete($filename); |
43 | - } catch (\Throwable $e) { |
|
47 | + } |
|
48 | + catch (\Throwable $e) |
|
49 | + { |
|
44 | 50 | // @codeCoverageIgnoreStart |
45 | 51 | $this->sprintf( |
46 | 52 | "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>\n", |
@@ -53,7 +59,8 @@ discard block |
||
53 | 59 | // @codeCoverageIgnoreEnd |
54 | 60 | } |
55 | 61 | |
56 | - if ($this->isVerbose()) { |
|
62 | + if ($this->isVerbose()) |
|
63 | + { |
|
57 | 64 | $this->sprintf( |
58 | 65 | "<fg=green>[deleted]</fg=green> `%s`\n", |
59 | 66 | $files->relativePath($filename, $config->getCacheDirectory()) |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))){ |
|
43 | 43 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 44 | |
45 | 45 | return; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | $manager->get($this->argument('locale')) |
52 | 52 | ); |
53 | 53 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
54 | + if ($this->isVerbose() && !empty($mc->getDomains())){ |
|
55 | 55 | $this->sprintf( |
56 | 56 | "<info>Exporting domain(s):</info> %s\n", |
57 | 57 | join(',', $mc->getDomains()) |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | 'xliff_version' => '2.0' // forcing default version for xliff dumper only |
67 | 67 | ]); |
68 | 68 | |
69 | - $this->writeln("Export successfully completed using <info>" . get_class($dumper) . "</info>"); |
|
70 | - $this->writeln("Output: <comment>" . realpath($this->argument('path')) . "</comment>"); |
|
69 | + $this->writeln("Export successfully completed using <info>".get_class($dumper)."</info>"); |
|
70 | + $this->writeln("Output: <comment>".realpath($this->argument('path'))."</comment>"); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | $catalogue->getData() |
87 | 87 | ); |
88 | 88 | |
89 | - if ($this->option('fallback')) { |
|
90 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
91 | - foreach ($messages as $id => $message) { |
|
92 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
89 | + if ($this->option('fallback')){ |
|
90 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){ |
|
91 | + foreach ($messages as $id => $message){ |
|
92 | + if (!$messageCatalogue->defines($id, $domain)){ |
|
93 | 93 | $messageCatalogue->set($id, $message, $domain); |
94 | 94 | } |
95 | 95 | } |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function perform(TranslatorConfig $config, CatalogueManager $manager) |
41 | 41 | { |
42 | - if (!$config->hasDumper($this->option('dumper'))) { |
|
42 | + if (!$config->hasDumper($this->option('dumper'))) |
|
43 | + { |
|
43 | 44 | $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>"); |
44 | 45 | |
45 | 46 | return; |
@@ -51,7 +52,8 @@ discard block |
||
51 | 52 | $manager->get($this->argument('locale')) |
52 | 53 | ); |
53 | 54 | |
54 | - if ($this->isVerbose() && !empty($mc->getDomains())) { |
|
55 | + if ($this->isVerbose() && !empty($mc->getDomains())) |
|
56 | + { |
|
55 | 57 | $this->sprintf( |
56 | 58 | "<info>Exporting domain(s):</info> %s\n", |
57 | 59 | join(',', $mc->getDomains()) |
@@ -86,10 +88,14 @@ discard block |
||
86 | 88 | $catalogue->getData() |
87 | 89 | ); |
88 | 90 | |
89 | - if ($this->option('fallback')) { |
|
90 | - foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) { |
|
91 | - foreach ($messages as $id => $message) { |
|
92 | - if (!$messageCatalogue->defines($id, $domain)) { |
|
91 | + if ($this->option('fallback')) |
|
92 | + { |
|
93 | + foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) |
|
94 | + { |
|
95 | + foreach ($messages as $id => $message) |
|
96 | + { |
|
97 | + if (!$messageCatalogue->defines($id, $domain)) |
|
98 | + { |
|
93 | 99 | $messageCatalogue->set($id, $message, $domain); |
94 | 100 | } |
95 | 101 | } |
@@ -12,8 +12,10 @@ |
||
12 | 12 | |
13 | 13 | class ErrorJob extends AbstractJob |
14 | 14 | { |
15 | - public function do() |
|
15 | + public function do{ |
|
16 | + () |
|
16 | 17 | { |
17 | 18 | throw new \ErrorException("bad job"); |
18 | 19 | } |
20 | + } |
|
19 | 21 | } |
@@ -13,8 +13,10 @@ |
||
13 | 13 | |
14 | 14 | class TestJob extends AbstractJob |
15 | 15 | { |
16 | - public function do(EnvironmentInterface $env) |
|
16 | + public function do{ |
|
17 | + (EnvironmentInterface $env) |
|
17 | 18 | { |
18 | 19 | $env->set('FIRED', true); |
19 | 20 | } |
21 | + } |
|
20 | 22 | } |
@@ -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 | } |