@@ -201,9 +201,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -201,9 +201,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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(); |
@@ -37,7 +37,7 @@ |
||
| 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 | |
@@ -37,7 +37,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -37,7 +37,8 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -32,16 +32,16 @@ |
||
| 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; |
@@ -32,16 +32,21 @@ |
||
| 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; |
@@ -24,7 +24,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -126,10 +126,12 @@ |
||
| 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 | { |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | abstract class BaseTest extends TestCase |
| 22 | 22 | { |
| 23 | 23 | public const TOKENIZER_CONFIG = [ |
| 24 | - 'directories' => [__DIR__ . '/Fixtures/'], |
|
| 24 | + 'directories' => [__DIR__.'/Fixtures/'], |
|
| 25 | 25 | 'exclude' => ['User'], |
| 26 | 26 | ]; |
| 27 | 27 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | class UpdateTest 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 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | ['command' => 'test', 'header' => 'Test Command'], |
| 36 | 36 | ['command' => 'helper', 'options' => ['helper' => 'writeln'], 'footer' => 'Good!'], |
| 37 | 37 | ['invoke' => [self::class, 'do']], |
| 38 | - ['invoke' => self::class . '::do'], |
|
| 38 | + ['invoke' => self::class.'::do'], |
|
| 39 | 39 | 'Spiral\Tests\Console\ok', |
| 40 | - ['invoke' => self::class . '::err'], |
|
| 40 | + ['invoke' => self::class.'::err'], |
|
| 41 | 41 | ] |
| 42 | 42 | ]; |
| 43 | 43 | |
@@ -126,10 +126,12 @@ |
||
| 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 | { |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function perform(): void |
| 24 | 24 | { |
| 25 | - throw new Exception('Unhandled another failed command error at ' . __METHOD__ . ' (line ' . __LINE__ . ')'); |
|
| 25 | + throw new Exception('Unhandled another failed command error at '.__METHOD__.' (line '.__LINE__.')'); |
|
| 26 | 26 | } |
| 27 | 27 | } |
@@ -22,6 +22,6 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function perform(): void |
| 24 | 24 | { |
| 25 | - throw new Exception('Unhandled failed command error at ' . __METHOD__ . ' (line ' . __LINE__ . ')'); |
|
| 25 | + throw new Exception('Unhandled failed command error at '.__METHOD__.' (line '.__LINE__.')'); |
|
| 26 | 26 | } |
| 27 | 27 | } |