Passed
Push — master ( 77392d...e0a3bd )
by Kirill
08:16 queued 11s
created
src/Exceptions/src/ValueWrapper.php 3 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,33 +56,33 @@
 block discarded – undo
56 56
     public function wrap(array $args): array
57 57
     {
58 58
         $result = [];
59
-        foreach ($args as $arg) {
59
+        foreach ($args as $arg){
60 60
             $display = $type = strtolower(gettype($arg));
61 61
 
62
-            if (is_numeric($arg)) {
62
+            if (is_numeric($arg)){
63 63
                 $result[] = $this->r->apply($arg, 'value', $type);
64 64
                 continue;
65
-            } elseif (is_bool($arg)) {
65
+            } elseif (is_bool($arg)){
66 66
                 $result[] = $this->r->apply($arg ? 'true' : 'false', 'value', $type);
67 67
                 continue;
68
-            } elseif (is_null($arg)) {
68
+            } elseif (is_null($arg)){
69 69
                 $result[] = $this->r->apply('null', 'value', $type);
70 70
                 continue;
71 71
             }
72 72
 
73
-            if (is_object($arg)) {
73
+            if (is_object($arg)){
74 74
                 $reflection = new \ReflectionClass($arg);
75 75
                 $display = sprintf('<span title="%s">%s</span>', $reflection->getName(), $reflection->getShortName());
76 76
             }
77 77
 
78 78
             $type = $this->r->apply($display, 'value', $type);
79 79
 
80
-            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG) {
80
+            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG){
81 81
                 $result[] = sprintf('<span>%s</span>', $type);
82
-            } else {
82
+            }else{
83 83
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg));
84 84
 
85
-                if (!isset($this->values[$hash])) {
85
+                if (!isset($this->values[$hash])){
86 86
                     $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
87 87
                 }
88 88
 
Please login to merge, or discard this patch.
Braces   +19 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,33 +56,44 @@
 block discarded – undo
56 56
     public function wrap(array $args): array
57 57
     {
58 58
         $result = [];
59
-        foreach ($args as $arg) {
59
+        foreach ($args as $arg)
60
+        {
60 61
             $display = $type = strtolower(gettype($arg));
61 62
 
62
-            if (is_numeric($arg)) {
63
+            if (is_numeric($arg))
64
+            {
63 65
                 $result[] = $this->r->apply($arg, 'value', $type);
64 66
                 continue;
65
-            } elseif (is_bool($arg)) {
67
+            }
68
+            elseif (is_bool($arg))
69
+            {
66 70
                 $result[] = $this->r->apply($arg ? 'true' : 'false', 'value', $type);
67 71
                 continue;
68
-            } elseif (is_null($arg)) {
72
+            }
73
+            elseif (is_null($arg))
74
+            {
69 75
                 $result[] = $this->r->apply('null', 'value', $type);
70 76
                 continue;
71 77
             }
72 78
 
73
-            if (is_object($arg)) {
79
+            if (is_object($arg))
80
+            {
74 81
                 $reflection = new \ReflectionClass($arg);
75 82
                 $display = sprintf('<span title="%s">%s</span>', $reflection->getName(), $reflection->getShortName());
76 83
             }
77 84
 
78 85
             $type = $this->r->apply($display, 'value', $type);
79 86
 
80
-            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG) {
87
+            if ($this->verbosity < HandlerInterface::VERBOSITY_DEBUG)
88
+            {
81 89
                 $result[] = sprintf('<span>%s</span>', $type);
82
-            } else {
90
+            }
91
+            else
92
+            {
83 93
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg));
84 94
 
85
-                if (!isset($this->values[$hash])) {
95
+                if (!isset($this->values[$hash]))
96
+                {
86 97
                     $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
87 98
                 }
88 99
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@
 block discarded – undo
83 83
                 $hash = is_object($arg) ? spl_object_hash($arg) : md5(json_encode($arg));
84 84
 
85 85
                 if (!isset($this->values[$hash])) {
86
-                    $this->values[$hash] = $this->dumper->dump($arg, Dumper::RETURN);
86
+                    $this->values[$hash] = $this->dumper->dump($arg, Dumper::return);
87 87
                 }
88 88
 
89 89
                 $result[] = sprintf('<span onclick="_da(\'%s\')">%s</span>', $hash, $type);
Please login to merge, or discard this patch.
src/Exceptions/tests/HandlerTest.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
         $handler = new ConsoleHandler();
202 202
         $handler->setColorsSupport(true);
203 203
 
204
-        try {
204
+        try{
205 205
             $this->makeException();
206
-        } catch (\Throwable $e) {
206
+        }catch (\Throwable $e){
207 207
         }
208 208
 
209 209
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -217,9 +217,9 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $handler = new PlainHandler();
219 219
 
220
-        try {
220
+        try{
221 221
             $this->makeException();
222
-        } catch (\Throwable $e) {
222
+        }catch (\Throwable $e){
223 223
         }
224 224
 
225 225
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
     {
233 233
         $handler = new JsonHandler();
234 234
 
235
-        try {
235
+        try{
236 236
             $this->makeException();
237
-        } catch (\Throwable $e) {
237
+        }catch (\Throwable $e){
238 238
         }
239 239
 
240 240
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
 
250 250
         $handler = new HtmlHandler(HtmlHandler::DEFAULT);
251 251
 
252
-        try {
252
+        try{
253 253
             $this->makeException();
254
-        } catch (\Throwable $e) {
254
+        }catch (\Throwable $e){
255 255
         }
256 256
 
257 257
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 
268 268
         $handler = new HtmlHandler(HtmlHandler::INVERTED);
269 269
 
270
-        try {
270
+        try{
271 271
             $this->makeException();
272
-        } catch (\Throwable $e) {
272
+        }catch (\Throwable $e){
273 273
         }
274 274
 
275 275
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
 
282 282
     public function makeException(): void
283 283
     {
284
-        try {
284
+        try{
285 285
             $f = function (): void {
286 286
                 throw new \RuntimeException('error');
287 287
             };
288 288
 
289 289
             $f();
290
-        } catch (\Throwable $e) {
290
+        }catch (\Throwable $e){
291 291
             throw new \LogicException('error', 0, $e);
292 292
         }
293 293
     }
Please login to merge, or discard this patch.
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -201,9 +201,12 @@  discard block
 block discarded – undo
201 201
         $handler = new ConsoleHandler();
202 202
         $handler->setColorsSupport(true);
203 203
 
204
-        try {
204
+        try
205
+        {
205 206
             $this->makeException();
206
-        } catch (\Throwable $e) {
207
+        }
208
+        catch (\Throwable $e)
209
+        {
207 210
         }
208 211
 
209 212
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -217,9 +220,12 @@  discard block
 block discarded – undo
217 220
     {
218 221
         $handler = new PlainHandler();
219 222
 
220
-        try {
223
+        try
224
+        {
221 225
             $this->makeException();
222
-        } catch (\Throwable $e) {
226
+        }
227
+        catch (\Throwable $e)
228
+        {
223 229
         }
224 230
 
225 231
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -232,9 +238,12 @@  discard block
 block discarded – undo
232 238
     {
233 239
         $handler = new JsonHandler();
234 240
 
235
-        try {
241
+        try
242
+        {
236 243
             $this->makeException();
237
-        } catch (\Throwable $e) {
244
+        }
245
+        catch (\Throwable $e)
246
+        {
238 247
         }
239 248
 
240 249
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -249,9 +258,12 @@  discard block
 block discarded – undo
249 258
 
250 259
         $handler = new HtmlHandler(HtmlHandler::DEFAULT);
251 260
 
252
-        try {
261
+        try
262
+        {
253 263
             $this->makeException();
254
-        } catch (\Throwable $e) {
264
+        }
265
+        catch (\Throwable $e)
266
+        {
255 267
         }
256 268
 
257 269
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -267,9 +279,12 @@  discard block
 block discarded – undo
267 279
 
268 280
         $handler = new HtmlHandler(HtmlHandler::INVERTED);
269 281
 
270
-        try {
282
+        try
283
+        {
271 284
             $this->makeException();
272
-        } catch (\Throwable $e) {
285
+        }
286
+        catch (\Throwable $e)
287
+        {
273 288
         }
274 289
 
275 290
         $result = $handler->renderException($e, HandlerInterface::VERBOSITY_DEBUG);
@@ -281,13 +296,16 @@  discard block
 block discarded – undo
281 296
 
282 297
     public function makeException(): void
283 298
     {
284
-        try {
299
+        try
300
+        {
285 301
             $f = function (): void {
286 302
                 throw new \RuntimeException('error');
287 303
             };
288 304
 
289 305
             $f();
290
-        } catch (\Throwable $e) {
306
+        }
307
+        catch (\Throwable $e)
308
+        {
291 309
             throw new \LogicException('error', 0, $e);
292 310
         }
293 311
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function testHtmlHandlerDefaultBasic(): void
115 115
     {
116
-        $handler = new HtmlHandler(HtmlHandler::DEFAULT);
116
+        $handler = new HtmlHandler(HtmlHandler::default);
117 117
 
118 118
         $result = $handler->renderException(new Error(
119 119
             'message',
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     {
165 165
         $this->markTestSkipped('FIXME: Very long execution time');
166 166
 
167
-        $handler = new HtmlHandler(HtmlHandler::DEFAULT);
167
+        $handler = new HtmlHandler(HtmlHandler::default);
168 168
 
169 169
         $result = $handler->renderException(new Error(
170 170
             'message',
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     {
248 248
         $this->markTestSkipped('FIXME: Very long execution time');
249 249
 
250
-        $handler = new HtmlHandler(HtmlHandler::DEFAULT);
250
+        $handler = new HtmlHandler(HtmlHandler::default);
251 251
 
252 252
         try {
253 253
             $this->makeException();
Please login to merge, or discard this patch.
src/Console/src/Sequence/CommandSequence.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         array $options = [],
38 38
         string $header = '',
39 39
         string $footer = ''
40
-    ) {
40
+    ){
41 41
         $this->command = $command;
42 42
         $this->options = $options;
43 43
 
Please login to merge, or discard this patch.
src/Console/src/Sequence/AbstractSequence.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function writeHeader(OutputInterface $output): void
39 39
     {
40
-        if (!empty($this->header)) {
40
+        if (!empty($this->header)){
41 41
             $output->writeln($this->header);
42 42
         }
43 43
     }
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     public function whiteFooter(OutputInterface $output): void
49 49
     {
50
-        if (!empty($this->footer)) {
50
+        if (!empty($this->footer)){
51 51
             $output->writeln($this->footer);
52 52
         }
53 53
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@  discard block
 block discarded – undo
37 37
      */
38 38
     public function writeHeader(OutputInterface $output): void
39 39
     {
40
-        if (!empty($this->header)) {
40
+        if (!empty($this->header))
41
+        {
41 42
             $output->writeln($this->header);
42 43
         }
43 44
     }
@@ -47,7 +48,8 @@  discard block
 block discarded – undo
47 48
      */
48 49
     public function whiteFooter(OutputInterface $output): void
49 50
     {
50
-        if (!empty($this->footer)) {
51
+        if (!empty($this->footer))
52
+        {
51 53
             $output->writeln($this->footer);
52 54
         }
53 55
     }
Please login to merge, or discard this patch.
src/Console/src/Command/SequenceCommand.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@
 block discarded – undo
32 32
     protected function runSequence(iterable $commands, ContainerInterface $container): int
33 33
     {
34 34
         $errors = 0;
35
-        foreach ($commands as $sequence) {
35
+        foreach ($commands as $sequence){
36 36
             $sequence->writeHeader($this->output);
37 37
 
38
-            try {
38
+            try{
39 39
                 $sequence->execute($container, $this->output);
40 40
                 $sequence->whiteFooter($this->output);
41
-            } catch (Throwable $e) {
41
+            }catch (Throwable $e){
42 42
                 $errors++;
43 43
                 $this->sprintf("<error>%s</error>\n", $e);
44
-                if (!$this->option('ignore') && $this->option('break')) {
44
+                if (!$this->option('ignore') && $this->option('break')){
45 45
                     $this->writeln('<fg=red>Aborting.</fg=red>');
46 46
 
47 47
                     return 1;
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,16 +32,21 @@
 block discarded – undo
32 32
     protected function runSequence(iterable $commands, ContainerInterface $container): int
33 33
     {
34 34
         $errors = 0;
35
-        foreach ($commands as $sequence) {
35
+        foreach ($commands as $sequence)
36
+        {
36 37
             $sequence->writeHeader($this->output);
37 38
 
38
-            try {
39
+            try
40
+            {
39 41
                 $sequence->execute($container, $this->output);
40 42
                 $sequence->whiteFooter($this->output);
41
-            } catch (Throwable $e) {
43
+            }
44
+            catch (Throwable $e)
45
+            {
42 46
                 $errors++;
43 47
                 $this->sprintf("<error>%s</error>\n", $e);
44
-                if (!$this->option('ignore') && $this->option('break')) {
48
+                if (!$this->option('ignore') && $this->option('break'))
49
+                {
45 50
                     $this->writeln('<fg=red>Aborting.</fg=red>');
46 51
 
47 52
                     return 1;
Please login to merge, or discard this patch.
src/Console/src/Command.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
      */
60 60
     protected function execute(InputInterface $input, OutputInterface $output)
61 61
     {
62
-        if ($this->container === null) {
62
+        if ($this->container === null){
63 63
             throw new ScopeException('Container is not set');
64 64
         }
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         /** @var ResolverInterface $resolver */
70 70
         $resolver = $this->container->get(ResolverInterface::class);
71 71
 
72
-        try {
72
+        try{
73 73
             list($this->input, $this->output) = [$input, $output];
74 74
 
75 75
             //Executing perform method with method injection
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
                 $reflection,
78 78
                 compact('input', 'output')
79 79
             ));
80
-        } finally {
80
+        }finally{
81 81
             [$this->input, $this->output] = [null, null];
82 82
         }
83 83
     }
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
         $this->setName(static::NAME);
91 91
         $this->setDescription(static::DESCRIPTION);
92 92
 
93
-        foreach ($this->defineOptions() as $option) {
93
+        foreach ($this->defineOptions() as $option){
94 94
             call_user_func_array([$this, 'addOption'], $option);
95 95
         }
96 96
 
97
-        foreach ($this->defineArguments() as $argument) {
97
+        foreach ($this->defineArguments() as $argument){
98 98
             call_user_func_array([$this, 'addArgument'], $argument);
99 99
         }
100 100
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -59,7 +59,8 @@  discard block
 block discarded – undo
59 59
      */
60 60
     protected function execute(InputInterface $input, OutputInterface $output)
61 61
     {
62
-        if ($this->container === null) {
62
+        if ($this->container === null)
63
+        {
63 64
             throw new ScopeException('Container is not set');
64 65
         }
65 66
 
@@ -69,7 +70,8 @@  discard block
 block discarded – undo
69 70
         /** @var ResolverInterface $resolver */
70 71
         $resolver = $this->container->get(ResolverInterface::class);
71 72
 
72
-        try {
73
+        try
74
+        {
73 75
             list($this->input, $this->output) = [$input, $output];
74 76
 
75 77
             //Executing perform method with method injection
@@ -77,7 +79,9 @@  discard block
 block discarded – undo
77 79
                 $reflection,
78 80
                 compact('input', 'output')
79 81
             ));
80
-        } finally {
82
+        }
83
+        finally
84
+        {
81 85
             [$this->input, $this->output] = [null, null];
82 86
         }
83 87
     }
@@ -90,11 +94,13 @@  discard block
 block discarded – undo
90 94
         $this->setName(static::NAME);
91 95
         $this->setDescription(static::DESCRIPTION);
92 96
 
93
-        foreach ($this->defineOptions() as $option) {
97
+        foreach ($this->defineOptions() as $option)
98
+        {
94 99
             call_user_func_array([$this, 'addOption'], $option);
95 100
         }
96 101
 
97
-        foreach ($this->defineArguments() as $argument) {
102
+        foreach ($this->defineArguments() as $argument)
103
+        {
98 104
             call_user_func_array([$this, 'addArgument'], $argument);
99 105
         }
100 106
     }
Please login to merge, or discard this patch.
src/Console/src/Config/ConsoleConfig.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getCommands(): array
57 57
     {
58
-        if (!array_key_exists('commands', $this->config)) {
58
+        if (!array_key_exists('commands', $this->config)){
59 59
             //Legacy config support
60 60
             return [];
61 61
         }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function configureSequence(): \Generator
74 74
     {
75 75
         $sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? [];
76
-        foreach ($sequence as $item) {
76
+        foreach ($sequence as $item){
77 77
             yield $this->parseSequence($item);
78 78
         }
79 79
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     public function updateSequence(): \Generator
89 89
     {
90 90
         $sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? [];
91
-        foreach ($sequence as $item) {
91
+        foreach ($sequence as $item){
92 92
             yield $this->parseSequence($item);
93 93
         }
94 94
     }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
      */
102 102
     protected function parseSequence($item): SequenceInterface
103 103
     {
104
-        if ($item instanceof SequenceInterface) {
104
+        if ($item instanceof SequenceInterface){
105 105
             return $item;
106 106
         }
107 107
 
108
-        if (is_string($item)) {
108
+        if (is_string($item)){
109 109
             return new CallableSequence($item);
110 110
         }
111 111
 
112
-        if (is_array($item) && isset($item['command'])) {
112
+        if (is_array($item) && isset($item['command'])){
113 113
             return new CommandSequence(
114 114
                 $item['command'],
115 115
                 $item['options'] ?? [],
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
             );
119 119
         }
120 120
 
121
-        if (is_array($item) && isset($item['invoke'])) {
121
+        if (is_array($item) && isset($item['invoke'])){
122 122
             return new CallableSequence(
123 123
                 $item['invoke'],
124 124
                 $item['parameters'] ?? [],
Please login to merge, or discard this patch.
Braces   +14 added lines, -7 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
      */
56 56
     public function getCommands(): array
57 57
     {
58
-        if (!array_key_exists('commands', $this->config)) {
58
+        if (!array_key_exists('commands', $this->config))
59
+        {
59 60
             //Legacy config support
60 61
             return [];
61 62
         }
@@ -73,7 +74,8 @@  discard block
 block discarded – undo
73 74
     public function configureSequence(): \Generator
74 75
     {
75 76
         $sequence = $this->config['configure'] ?? $this->config['configureSequence'] ?? [];
76
-        foreach ($sequence as $item) {
77
+        foreach ($sequence as $item)
78
+        {
77 79
             yield $this->parseSequence($item);
78 80
         }
79 81
     }
@@ -88,7 +90,8 @@  discard block
 block discarded – undo
88 90
     public function updateSequence(): \Generator
89 91
     {
90 92
         $sequence = $this->config['update'] ?? $this->config['updateSequence'] ?? [];
91
-        foreach ($sequence as $item) {
93
+        foreach ($sequence as $item)
94
+        {
92 95
             yield $this->parseSequence($item);
93 96
         }
94 97
     }
@@ -101,15 +104,18 @@  discard block
 block discarded – undo
101 104
      */
102 105
     protected function parseSequence($item): SequenceInterface
103 106
     {
104
-        if ($item instanceof SequenceInterface) {
107
+        if ($item instanceof SequenceInterface)
108
+        {
105 109
             return $item;
106 110
         }
107 111
 
108
-        if (is_string($item)) {
112
+        if (is_string($item))
113
+        {
109 114
             return new CallableSequence($item);
110 115
         }
111 116
 
112
-        if (is_array($item) && isset($item['command'])) {
117
+        if (is_array($item) && isset($item['command']))
118
+        {
113 119
             return new CommandSequence(
114 120
                 $item['command'],
115 121
                 $item['options'] ?? [],
@@ -118,7 +124,8 @@  discard block
 block discarded – undo
118 124
             );
119 125
         }
120 126
 
121
-        if (is_array($item) && isset($item['invoke'])) {
127
+        if (is_array($item) && isset($item['invoke']))
128
+        {
122 129
             return new CallableSequence(
123 130
                 $item['invoke'],
124 131
                 $item['parameters'] ?? [],
Please login to merge, or discard this patch.
src/Console/src/Console.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         ConsoleConfig $config,
53 53
         LocatorInterface $locator = null,
54 54
         ContainerInterface $container = null
55
-    ) {
55
+    ){
56 56
         $this->config = $config;
57 57
         $this->locator = $locator;
58 58
         $this->container = $container ?? new Container();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
         $this->configureIO($input, $output);
104 104
 
105
-        if ($command !== null) {
105
+        if ($command !== null){
106 106
             $input = new InputProxy($input, ['firstArgument' => $command]);
107 107
         }
108 108
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
      */
123 123
     public function getApplication(): Application
124 124
     {
125
-        if ($this->application !== null) {
125
+        if ($this->application !== null){
126 126
             return $this->application;
127 127
         }
128 128
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $this->application->setCatchExceptions(false);
131 131
         $this->application->setAutoExit(false);
132 132
 
133
-        if ($this->locator !== null) {
133
+        if ($this->locator !== null){
134 134
             $this->addCommands($this->locator->locateCommands());
135 135
         }
136 136
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function addCommands(iterable $commands): void
148 148
     {
149
-        foreach ($commands as $command) {
150
-            if ($command instanceof Command) {
149
+        foreach ($commands as $command){
150
+            if ($command instanceof Command){
151 151
                 $command->setContainer($this->container);
152 152
             }
153 153
 
@@ -164,27 +164,27 @@  discard block
 block discarded – undo
164 164
      */
165 165
     private function configureIO(InputInterface $input, OutputInterface $output): void
166 166
     {
167
-        if (true === $input->hasParameterOption(['--ansi'], true)) {
167
+        if (true === $input->hasParameterOption(['--ansi'], true)){
168 168
             $output->setDecorated(true);
169
-        } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
169
+        } elseif (true === $input->hasParameterOption(['--no-ansi'], true)){
170 170
             $output->setDecorated(false);
171 171
         }
172 172
 
173
-        if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
173
+        if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)){
174 174
             $input->setInteractive(false);
175
-        } elseif (\function_exists('posix_isatty')) {
175
+        } elseif (\function_exists('posix_isatty')){
176 176
             $inputStream = null;
177 177
 
178
-            if ($input instanceof StreamableInputInterface) {
178
+            if ($input instanceof StreamableInputInterface){
179 179
                 $inputStream = $input->getStream();
180 180
             }
181 181
 
182
-            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
182
+            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')){
183 183
                 $input->setInteractive(false);
184 184
             }
185 185
         }
186 186
 
187
-        switch ($shellVerbosity = (int)getenv('SHELL_VERBOSITY')) {
187
+        switch ($shellVerbosity = (int)getenv('SHELL_VERBOSITY')){
188 188
             case -1:
189 189
                 $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
190 190
                 break;
@@ -204,22 +204,22 @@  discard block
 block discarded – undo
204 204
 
205 205
         if (
206 206
             true === $input->hasParameterOption(['--quiet', '-q'], true)
207
-        ) {
207
+        ){
208 208
             $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
209 209
             $shellVerbosity = -1;
210
-        } else {
210
+        }else{
211 211
             if (
212 212
                 $input->hasParameterOption('-vvv', true)
213 213
                 || $input->hasParameterOption('--verbose=3', true)
214 214
                 || 3 === $input->getParameterOption('--verbose', false, true)
215
-            ) {
215
+            ){
216 216
                 $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
217 217
                 $shellVerbosity = 3;
218 218
             } elseif (
219 219
                 $input->hasParameterOption('-vv', true)
220 220
                 || $input->hasParameterOption('--verbose=2', true)
221 221
                 || 2 === $input->getParameterOption('--verbose', false, true)
222
-            ) {
222
+            ){
223 223
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
224 224
                 $shellVerbosity = 2;
225 225
             } elseif (
@@ -227,17 +227,17 @@  discard block
 block discarded – undo
227 227
                 || $input->hasParameterOption('--verbose=1', true)
228 228
                 || $input->hasParameterOption('--verbose', true)
229 229
                 || $input->getParameterOption('--verbose', false, true)
230
-            ) {
230
+            ){
231 231
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
232 232
                 $shellVerbosity = 1;
233 233
             }
234 234
         }
235 235
 
236
-        if (-1 === $shellVerbosity) {
236
+        if (-1 === $shellVerbosity){
237 237
             $input->setInteractive(false);
238 238
         }
239 239
 
240
-        putenv('SHELL_VERBOSITY=' . $shellVerbosity);
240
+        putenv('SHELL_VERBOSITY='.$shellVerbosity);
241 241
         $_ENV['SHELL_VERBOSITY'] = $shellVerbosity;
242 242
         $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity;
243 243
     }
Please login to merge, or discard this patch.
Braces   +39 added lines, -18 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@  discard block
 block discarded – undo
72 72
         $input = $input ?? new ArgvInput();
73 73
         $output = $output ?? new ConsoleOutput();
74 74
 
75
-        return ContainerScope::runScope($this->container, function () use ($input, $output) {
75
+        return ContainerScope::runScope($this->container, function () use ($input, $output)
76
+        {
76 77
             return $this->run(
77 78
                 $input->getFirstArgument() ?? 'list',
78 79
                 $input,
@@ -102,11 +103,13 @@  discard block
 block discarded – undo
102 103
 
103 104
         $this->configureIO($input, $output);
104 105
 
105
-        if ($command !== null) {
106
+        if ($command !== null)
107
+        {
106 108
             $input = new InputProxy($input, ['firstArgument' => $command]);
107 109
         }
108 110
 
109
-        $code = ContainerScope::runScope($this->container, function () use ($input, $output) {
111
+        $code = ContainerScope::runScope($this->container, function () use ($input, $output)
112
+        {
110 113
             return $this->getApplication()->doRun($input, $output);
111 114
         });
112 115
 
@@ -122,7 +125,8 @@  discard block
 block discarded – undo
122 125
      */
123 126
     public function getApplication(): Application
124 127
     {
125
-        if ($this->application !== null) {
128
+        if ($this->application !== null)
129
+        {
126 130
             return $this->application;
127 131
         }
128 132
 
@@ -130,7 +134,8 @@  discard block
 block discarded – undo
130 134
         $this->application->setCatchExceptions(false);
131 135
         $this->application->setAutoExit(false);
132 136
 
133
-        if ($this->locator !== null) {
137
+        if ($this->locator !== null)
138
+        {
134 139
             $this->addCommands($this->locator->locateCommands());
135 140
         }
136 141
 
@@ -146,8 +151,10 @@  discard block
 block discarded – undo
146 151
      */
147 152
     private function addCommands(iterable $commands): void
148 153
     {
149
-        foreach ($commands as $command) {
150
-            if ($command instanceof Command) {
154
+        foreach ($commands as $command)
155
+        {
156
+            if ($command instanceof Command)
157
+            {
151 158
                 $command->setContainer($this->container);
152 159
             }
153 160
 
@@ -164,27 +171,36 @@  discard block
 block discarded – undo
164 171
      */
165 172
     private function configureIO(InputInterface $input, OutputInterface $output): void
166 173
     {
167
-        if (true === $input->hasParameterOption(['--ansi'], true)) {
174
+        if (true === $input->hasParameterOption(['--ansi'], true))
175
+        {
168 176
             $output->setDecorated(true);
169
-        } elseif (true === $input->hasParameterOption(['--no-ansi'], true)) {
177
+        }
178
+        elseif (true === $input->hasParameterOption(['--no-ansi'], true))
179
+        {
170 180
             $output->setDecorated(false);
171 181
         }
172 182
 
173
-        if (true === $input->hasParameterOption(['--no-interaction', '-n'], true)) {
183
+        if (true === $input->hasParameterOption(['--no-interaction', '-n'], true))
184
+        {
174 185
             $input->setInteractive(false);
175
-        } elseif (\function_exists('posix_isatty')) {
186
+        }
187
+        elseif (\function_exists('posix_isatty'))
188
+        {
176 189
             $inputStream = null;
177 190
 
178
-            if ($input instanceof StreamableInputInterface) {
191
+            if ($input instanceof StreamableInputInterface)
192
+            {
179 193
                 $inputStream = $input->getStream();
180 194
             }
181 195
 
182
-            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
196
+            if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE'))
197
+            {
183 198
                 $input->setInteractive(false);
184 199
             }
185 200
         }
186 201
 
187
-        switch ($shellVerbosity = (int)getenv('SHELL_VERBOSITY')) {
202
+        switch ($shellVerbosity = (int)getenv('SHELL_VERBOSITY'))
203
+        {
188 204
             case -1:
189 205
                 $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
190 206
                 break;
@@ -207,7 +223,9 @@  discard block
 block discarded – undo
207 223
         ) {
208 224
             $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
209 225
             $shellVerbosity = -1;
210
-        } else {
226
+        }
227
+        else
228
+        {
211 229
             if (
212 230
                 $input->hasParameterOption('-vvv', true)
213 231
                 || $input->hasParameterOption('--verbose=3', true)
@@ -215,14 +233,16 @@  discard block
 block discarded – undo
215 233
             ) {
216 234
                 $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
217 235
                 $shellVerbosity = 3;
218
-            } elseif (
236
+            }
237
+            elseif (
219 238
                 $input->hasParameterOption('-vv', true)
220 239
                 || $input->hasParameterOption('--verbose=2', true)
221 240
                 || 2 === $input->getParameterOption('--verbose', false, true)
222 241
             ) {
223 242
                 $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
224 243
                 $shellVerbosity = 2;
225
-            } elseif (
244
+            }
245
+            elseif (
226 246
                 $input->hasParameterOption('-v', true)
227 247
                 || $input->hasParameterOption('--verbose=1', true)
228 248
                 || $input->hasParameterOption('--verbose', true)
@@ -233,7 +253,8 @@  discard block
 block discarded – undo
233 253
             }
234 254
         }
235 255
 
236
-        if (-1 === $shellVerbosity) {
256
+        if (-1 === $shellVerbosity)
257
+        {
237 258
             $input->setInteractive(false);
238 259
         }
239 260
 
Please login to merge, or discard this patch.
src/Console/tests/ConfigureTest.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 class ConfigureTest extends BaseTest
25 25
 {
26 26
     public const TOKENIZER_CONFIG = [
27
-        'directories' => [__DIR__ . '/../src/Command', __DIR__ . '/Fixtures/'],
27
+        'directories' => [__DIR__.'/../src/Command', __DIR__.'/Fixtures/'],
28 28
         'exclude'     => []
29 29
     ];
30 30
 
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
             ['command' => 'test', 'header' => 'Test Command'],
35 35
             ['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'],
36 36
             ['invoke' => [self::class, 'do']],
37
-            ['invoke' => self::class . '::do'],
37
+            ['invoke' => self::class.'::do'],
38 38
             'Spiral\Tests\Console\ok',
39
-            ['invoke' => self::class . '::err'],
39
+            ['invoke' => self::class.'::err'],
40 40
         ]
41 41
     ];
42 42
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,10 +126,12 @@
 block discarded – undo
126 126
         $this->assertEquals(1, $output->getCode());
127 127
     }
128 128
 
129
-    public function do(OutputInterface $output): void
129
+    public function do{
130
+        (OutputInterface $output): void
130 131
     {
131 132
         $output->write('OK');
132 133
     }
134
+    }
133 135
 
134 136
     public function err(OutputInterface $output): void
135 137
     {
Please login to merge, or discard this patch.