@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public function offsetGet($offset) |
73 | 73 | { |
74 | - if (!$this->offsetExists($offset)) { |
|
74 | + if (!$this->offsetExists($offset)){ |
|
75 | 75 | throw new ConfigException("Undefined configuration key '{$offset}'"); |
76 | 76 | } |
77 | 77 |
@@ -71,7 +71,8 @@ |
||
71 | 71 | */ |
72 | 72 | public function offsetGet($offset) |
73 | 73 | { |
74 | - if (!$this->offsetExists($offset)) { |
|
74 | + if (!$this->offsetExists($offset)) |
|
75 | + { |
|
75 | 76 | throw new ConfigException("Undefined configuration key '{$offset}'"); |
76 | 77 | } |
77 | 78 |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function resolveAlias(string $alias): string |
26 | 26 | { |
27 | - while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias])) { |
|
27 | + while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias])){ |
|
28 | 28 | $alias = $this->config['aliases'][$alias]; |
29 | 29 | } |
30 | 30 |
@@ -24,7 +24,8 @@ |
||
24 | 24 | */ |
25 | 25 | public function resolveAlias(string $alias): string |
26 | 26 | { |
27 | - while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias])) { |
|
27 | + while (is_string($alias) && isset($this->config) && isset($this->config['aliases'][$alias])) |
|
28 | + { |
|
28 | 29 | $alias = $this->config['aliases'][$alias]; |
29 | 30 | } |
30 | 31 |
@@ -58,22 +58,22 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function wire($definition): Autowire |
60 | 60 | { |
61 | - if ($definition instanceof self) { |
|
61 | + if ($definition instanceof self){ |
|
62 | 62 | return $definition; |
63 | 63 | } |
64 | 64 | |
65 | - if (is_string($definition)) { |
|
65 | + if (is_string($definition)){ |
|
66 | 66 | return new Autowire($definition); |
67 | 67 | } |
68 | 68 | |
69 | - if (is_array($definition) && isset($definition['class'])) { |
|
69 | + if (is_array($definition) && isset($definition['class'])){ |
|
70 | 70 | return new Autowire( |
71 | 71 | $definition['class'], |
72 | 72 | $definition['options'] ?? $definition['params'] ?? [] |
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | - if (is_object($definition)) { |
|
76 | + if (is_object($definition)){ |
|
77 | 77 | $autowire = new self(get_class($definition), []); |
78 | 78 | $autowire->target = $definition; |
79 | 79 | return $autowire; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function resolve(FactoryInterface $factory, array $parameters = []) |
94 | 94 | { |
95 | - if ($this->target !== null) { |
|
95 | + if ($this->target !== null){ |
|
96 | 96 | // pre-wired |
97 | 97 | return $this->target; |
98 | 98 | } |
@@ -58,22 +58,26 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public static function wire($definition): Autowire |
60 | 60 | { |
61 | - if ($definition instanceof self) { |
|
61 | + if ($definition instanceof self) |
|
62 | + { |
|
62 | 63 | return $definition; |
63 | 64 | } |
64 | 65 | |
65 | - if (is_string($definition)) { |
|
66 | + if (is_string($definition)) |
|
67 | + { |
|
66 | 68 | return new Autowire($definition); |
67 | 69 | } |
68 | 70 | |
69 | - if (is_array($definition) && isset($definition['class'])) { |
|
71 | + if (is_array($definition) && isset($definition['class'])) |
|
72 | + { |
|
70 | 73 | return new Autowire( |
71 | 74 | $definition['class'], |
72 | 75 | $definition['options'] ?? $definition['params'] ?? [] |
73 | 76 | ); |
74 | 77 | } |
75 | 78 | |
76 | - if (is_object($definition)) { |
|
79 | + if (is_object($definition)) |
|
80 | + { |
|
77 | 81 | $autowire = new self(get_class($definition), []); |
78 | 82 | $autowire->target = $definition; |
79 | 83 | return $autowire; |
@@ -92,7 +96,8 @@ discard block |
||
92 | 96 | */ |
93 | 97 | public function resolve(FactoryInterface $factory, array $parameters = []) |
94 | 98 | { |
95 | - if ($this->target !== null) { |
|
99 | + if ($this->target !== null) |
|
100 | + { |
|
96 | 101 | // pre-wired |
97 | 102 | return $this->target; |
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 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function setUp(): void |
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 | return; |
27 | 27 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | parent::setUp(); |
30 | 30 | |
31 | 31 | $fs = new Files(); |
32 | - $this->proto = $fs->normalizePath($this->app->dir('app') . 'proto/service.proto'); |
|
32 | + $this->proto = $fs->normalizePath($this->app->dir('app').'proto/service.proto'); |
|
33 | 33 | |
34 | 34 | // protoc can't figure relative paths |
35 | 35 | $this->proto = str_replace('Framework/../', '', $this->proto); |
@@ -41,12 +41,12 @@ discard block |
||
41 | 41 | |
42 | 42 | $fs = new Files(); |
43 | 43 | |
44 | - if ($fs->isDirectory($this->app->dir('app') . 'src/Service')) { |
|
45 | - $fs->deleteDirectory($this->app->dir('app') . 'src/Service'); |
|
44 | + if ($fs->isDirectory($this->app->dir('app').'src/Service')){ |
|
45 | + $fs->deleteDirectory($this->app->dir('app').'src/Service'); |
|
46 | 46 | } |
47 | 47 | |
48 | - if ($fs->isDirectory($this->app->dir('app') . 'src/GPBMetadata')) { |
|
49 | - $fs->deleteDirectory($this->app->dir('app') . 'src/GPBMetadata'); |
|
48 | + if ($fs->isDirectory($this->app->dir('app').'src/GPBMetadata')){ |
|
49 | + $fs->deleteDirectory($this->app->dir('app').'src/GPBMetadata'); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | 'proto' => $this->proto |
64 | 64 | ]); |
65 | 65 | |
66 | - $output = $this->app->dir('app') . 'src/Service/EchoService.php'; |
|
66 | + $output = $this->app->dir('app').'src/Service/EchoService.php'; |
|
67 | 67 | file_put_contents($output, GenerateTest::SERVICE); |
68 | 68 | |
69 | 69 | $out = $this->runCommandDebug('grpc:services'); |
@@ -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 | }) |
@@ -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->assertFalse(is_file(sys_get_temp_dir() . '/messages.ru.php')); |
|
29 | + $this->assertFalse(is_file(sys_get_temp_dir().'/messages.ru.php')); |
|
30 | 30 | |
31 | 31 | $this->runCommandDebug('i18n:index'); |
32 | 32 | $this->runCommandDebug('configure'); |