@@ -18,7 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | $response = \GuzzleHttp\json_decode($res->getBody(), true); |
| 20 | 20 | |
| 21 | - $tags = \array_map(function (array $item) { |
|
| 21 | + $tags = \array_map(function(array $item) { |
|
| 22 | 22 | return $item['name']; |
| 23 | 23 | }, $response); |
| 24 | 24 | |
@@ -126,7 +126,7 @@ |
||
| 126 | 126 | throw new \RuntimeException('Payload object should implement JsonSerializable. Got an instance of ' . \get_class($payload)); |
| 127 | 127 | } |
| 128 | 128 | $replies = self::dispatch($event, \GuzzleHttp\json_encode($payload)); |
| 129 | - return \array_map(function (string $reply) { |
|
| 129 | + return \array_map(function(string $reply) { |
|
| 130 | 130 | return \GuzzleHttp\json_decode($reply, true); |
| 131 | 131 | }, $replies); |
| 132 | 132 | } |
@@ -71,9 +71,9 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | public function getAllEventNames(): array |
| 73 | 73 | { |
| 74 | - return array_map(function (AbstractEventCommand $event) { |
|
| 74 | + return array_map(function(AbstractEventCommand $event) { |
|
| 75 | 75 | return $event->getEventName(); |
| 76 | - }, \array_filter($this->getApplication()->all(), function (Command $command) { |
|
| 76 | + }, \array_filter($this->getApplication()->all(), function(Command $command) { |
|
| 77 | 77 | return $command instanceof AbstractEventCommand && !$command->isHidden(); |
| 78 | 78 | })); |
| 79 | 79 | } |
@@ -7,6 +7,6 @@ |
||
| 7 | 7 | { |
| 8 | 8 | public static function cannotHandleEvent(string $eventName): self |
| 9 | 9 | { |
| 10 | - return new self('Could not find an Aent that can handle events of type "'.$eventName.'"'); |
|
| 10 | + return new self('Could not find an Aent that can handle events of type "' . $eventName . '"'); |
|
| 11 | 11 | } |
| 12 | 12 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $validator = $this->validator; |
| 76 | 76 | |
| 77 | 77 | if ($this->yesNoQuestion) { |
| 78 | - $validator = function (?string $response) use ($validator) { |
|
| 78 | + $validator = function(?string $response) use ($validator) { |
|
| 79 | 79 | $response = $response ?? ''; |
| 80 | 80 | $response = \strtolower(trim($response)); |
| 81 | 81 | if (!\in_array($response, ['y', 'n', 'yes', 'no'], true)) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if (null !== $this->helpText) { |
| 90 | - $validator = function (?string $response) use ($validator) { |
|
| 90 | + $validator = function(?string $response) use ($validator) { |
|
| 91 | 91 | $response = $response ?? ''; |
| 92 | 92 | if (trim($response) === '?') { |
| 93 | 93 | $this->output->writeln($this->helpText ?: ''); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | if ($this->compulsory) { |
| 101 | - $validator = function (?string $response) use ($validator) { |
|
| 101 | + $validator = function(?string $response) use ($validator) { |
|
| 102 | 102 | $response = $response ?? ''; |
| 103 | 103 | if (trim($response) === '') { |
| 104 | 104 | throw new \InvalidArgumentException('This field is compulsory.'); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return $validator ? $validator($response) : $response; |
| 107 | 107 | }; |
| 108 | 108 | } else { |
| 109 | - $validator = function (?string $response) use ($validator) { |
|
| 109 | + $validator = function(?string $response) use ($validator) { |
|
| 110 | 110 | $response = $response ?? ''; |
| 111 | 111 | if (trim($response) === '') { |
| 112 | 112 | return $response; |
@@ -131,6 +131,6 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | $this->spacer(); |
| 133 | 133 | |
| 134 | - return \is_string($answer)? $answer: (string)$answer; |
|
| 134 | + return \is_string($answer) ? $answer : (string) $answer; |
|
| 135 | 135 | } |
| 136 | 136 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | $question = new SymfonyQuestion("Select your $applicationName version [$default]: ", $default); |
| 61 | 61 | |
| 62 | 62 | $question->setAutocompleterValues($availableVersions); |
| 63 | - $question->setValidator(function (string $value) use ($availableVersions, $dockerHubImage) { |
|
| 63 | + $question->setValidator(function(string $value) use ($availableVersions, $dockerHubImage) { |
|
| 64 | 64 | $value = trim($value); |
| 65 | 65 | |
| 66 | 66 | if ($value === 'v') { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $answer = $this->helper->ask($this->input, $this->output, $question); |
| 46 | 46 | } while ($this->helpText !== null && $answer === '?'); |
| 47 | 47 | |
| 48 | - return \is_string($answer)? $answer: (string)$answer; |
|
| 48 | + return \is_string($answer) ? $answer : (string) $answer; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** @return string[] */ |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $answer = $this->helper->ask($this->input, $this->output, $question); |
| 58 | 58 | } while ($this->helpText !== null && $answer === '?'); |
| 59 | 59 | |
| 60 | - return \is_array($answer) ? $answer : [\is_string($answer) ? $answer : (string)$answer]; |
|
| 60 | + return \is_array($answer) ? $answer : [\is_string($answer) ? $answer : (string) $answer]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | private function initQuestion(bool $multiselect): SymfonyChoiceQuestion |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | $choices = $this->choices; |
| 86 | 86 | $errorMessage = 'Value "%s" is invalid'; |
| 87 | 87 | $multiselect = $this->multiselect; |
| 88 | - $isAssoc = (bool)count(array_filter(array_keys($this->choices), '\is_string')); |
|
| 88 | + $isAssoc = (bool) count(array_filter(array_keys($this->choices), '\is_string')); |
|
| 89 | 89 | |
| 90 | - return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 90 | + return function($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) { |
|
| 91 | 91 | |
| 92 | 92 | // Collapse all spaces. |
| 93 | 93 | $selectedChoices = str_replace(' ', '', $selected); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (false === $result) { |
| 136 | 136 | throw new InvalidArgumentException(sprintf($errorMessage, $value)); |
| 137 | 137 | } |
| 138 | - $multiselectChoices[] = (string)$result; |
|
| 138 | + $multiselectChoices[] = (string) $result; |
|
| 139 | 139 | } |
| 140 | 140 | if ($multiselect) { |
| 141 | 141 | if ($this->printAnswer) { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | { |
| 38 | 38 | $this->parser = new Parser(); |
| 39 | 39 | $this->dumper = new Dumper(); |
| 40 | - $this->path = __DIR__.'/Fixtures'; |
|
| 40 | + $this->path = __DIR__ . '/Fixtures'; |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | protected function tearDown() |
@@ -75,9 +75,9 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | public function testSpecifications() |
| 77 | 77 | { |
| 78 | - $files = $this->parser->parse(file_get_contents($this->path.'/index.yml')); |
|
| 78 | + $files = $this->parser->parse(file_get_contents($this->path . '/index.yml')); |
|
| 79 | 79 | foreach ($files as $file) { |
| 80 | - $yamls = file_get_contents($this->path.'/'.$file.'.yml'); |
|
| 80 | + $yamls = file_get_contents($this->path . '/' . $file . '.yml'); |
|
| 81 | 81 | |
| 82 | 82 | // split YAMLs documents |
| 83 | 83 | foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } elseif (isset($test['todo']) && $test['todo']) { |
| 92 | 92 | // TODO |
| 93 | 93 | } else { |
| 94 | - eval('$expected = '.trim($test['php']).';'); |
|
| 94 | + eval('$expected = ' . trim($test['php']) . ';'); |
|
| 95 | 95 | $this->assertSame($expected, $this->parser->parse($this->dumper->dump($expected, 10)), $test['test']); |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | public function testBinaryDataIsDumpedBase64Encoded() |
| 232 | 232 | { |
| 233 | - $binaryData = file_get_contents(__DIR__.'/Fixtures/arrow.gif'); |
|
| 234 | - $expected = '{ data: !!binary '.base64_encode($binaryData).' }'; |
|
| 233 | + $binaryData = file_get_contents(__DIR__ . '/Fixtures/arrow.gif'); |
|
| 234 | + $expected = '{ data: !!binary ' . base64_encode($binaryData) . ' }'; |
|
| 235 | 235 | |
| 236 | 236 | $this->assertSame($expected, $this->dumper->dump(array('data' => $binaryData))); |
| 237 | 237 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | ), |
| 382 | 382 | ); |
| 383 | 383 | |
| 384 | - $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); |
|
| 384 | + $this->assertSame(file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | public function testDumpMultiLineStringAsScalarBlockWhenFirstLineHasLeadingSpace() |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | ), |
| 393 | 393 | ); |
| 394 | 394 | |
| 395 | - $this->assertSame(file_get_contents(__DIR__.'/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); |
|
| 395 | + $this->assertSame(file_get_contents(__DIR__ . '/Fixtures/multiple_lines_as_literal_block_leading_space_in_first_line.yml'), $this->dumper->dump($data, 2, 0, Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK)); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | public function testCarriageReturnIsMaintainedWhenDumpingAsMultiLineLiteralBlock() |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | 'value' => $this->value, |
| 62 | 62 | 'type' => $this->type, |
| 63 | 63 | 'comment' => $this->comment |
| 64 | - ], function ($v) { |
|
| 64 | + ], function($v) { |
|
| 65 | 65 | return null !== $v; |
| 66 | 66 | }); |
| 67 | 67 | } |