@@ -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 | } |
@@ -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); |