@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | $suffix = preg_quote($suffix); |
289 | - $regex = '{('.$suffix.')(?:'.$suffix.')++$}D'; |
|
289 | + $regex = '{(' . $suffix . ')(?:' . $suffix . ')++$}D'; |
|
290 | 290 | |
291 | - return $this->replaceMatches($regex.($this->ignoreCase ? 'i' : ''), '$1'); |
|
291 | + return $this->replaceMatches($regex . ($this->ignoreCase ? 'i' : ''), '$1'); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $delimiter .= 'i'; |
503 | 503 | } |
504 | 504 | |
505 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
505 | + set_error_handler(static function($t, $m) { throw new InvalidArgumentException($m); }); |
|
506 | 506 | |
507 | 507 | try { |
508 | 508 | if (false === $chunks = preg_split($delimiter, $this->string, $limit, $flags)) { |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | |
511 | 511 | foreach (get_defined_constants(true)['pcre'] as $k => $v) { |
512 | 512 | if ($lastError === $v && '_ERROR' === substr($k, -6)) { |
513 | - throw new RuntimeException('Splitting failed with '.$k.'.'); |
|
513 | + throw new RuntimeException('Splitting failed with ' . $k . '.'); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | return $b; |
573 | 573 | } |
574 | 574 | |
575 | - set_error_handler(static function ($t, $m) { throw new InvalidArgumentException($m); }); |
|
575 | + set_error_handler(static function($t, $m) { throw new InvalidArgumentException($m); }); |
|
576 | 576 | |
577 | 577 | try { |
578 | 578 | try { |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | } |
774 | 774 | |
775 | 775 | $str = clone $this; |
776 | - $str->string = $string.implode('', $chars); |
|
776 | + $str->string = $string . implode('', $chars); |
|
777 | 777 | |
778 | 778 | return $str; |
779 | 779 | } |
@@ -22,6 +22,6 @@ |
||
22 | 22 | */ |
23 | 23 | function trigger_deprecation(string $package, string $version, string $message, ...$args): void |
24 | 24 | { |
25 | - @trigger_error(($package || $version ? "Since $package $version: " : '').($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
25 | + @trigger_error(($package || $version ? "Since $package $version: " : '') . ($args ? vsprintf($message, $args) : $message), \E_USER_DEPRECATED); |
|
26 | 26 | } |
27 | 27 | } |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | public function run(InputInterface $input = null, OutputInterface $output = null) |
138 | 138 | { |
139 | 139 | if (\function_exists('putenv')) { |
140 | - @putenv('LINES='.$this->terminal->getHeight()); |
|
141 | - @putenv('COLUMNS='.$this->terminal->getWidth()); |
|
140 | + @putenv('LINES=' . $this->terminal->getHeight()); |
|
141 | + @putenv('COLUMNS=' . $this->terminal->getWidth()); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | if (null === $input) { |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | $output = new ConsoleOutput(); |
150 | 150 | } |
151 | 151 | |
152 | - $renderException = function (\Throwable $e) use ($output) { |
|
152 | + $renderException = function(\Throwable $e) use ($output) { |
|
153 | 153 | if ($output instanceof ConsoleOutputInterface) { |
154 | 154 | $this->renderThrowable($e, $output->getErrorOutput()); |
155 | 155 | } else { |
@@ -631,8 +631,8 @@ discard block |
||
631 | 631 | public function findNamespace(string $namespace) |
632 | 632 | { |
633 | 633 | $allNamespaces = $this->getNamespaces(); |
634 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))).'[^:]*'; |
|
635 | - $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces); |
|
634 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $namespace))) . '[^:]*'; |
|
635 | + $namespaces = preg_grep('{^' . $expr . '}', $allNamespaces); |
|
636 | 636 | |
637 | 637 | if (empty($namespaces)) { |
638 | 638 | $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); |
@@ -687,15 +687,15 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | $allCommands = $this->commandLoader ? array_merge($this->commandLoader->getNames(), array_keys($this->commands)) : array_keys($this->commands); |
690 | - $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))).'[^:]*'; |
|
691 | - $commands = preg_grep('{^'.$expr.'}', $allCommands); |
|
690 | + $expr = implode('[^:]*:', array_map('preg_quote', explode(':', $name))) . '[^:]*'; |
|
691 | + $commands = preg_grep('{^' . $expr . '}', $allCommands); |
|
692 | 692 | |
693 | 693 | if (empty($commands)) { |
694 | - $commands = preg_grep('{^'.$expr.'}i', $allCommands); |
|
694 | + $commands = preg_grep('{^' . $expr . '}i', $allCommands); |
|
695 | 695 | } |
696 | 696 | |
697 | 697 | // if no commands matched or we just matched namespaces |
698 | - if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { |
|
698 | + if (empty($commands) || \count(preg_grep('{^' . $expr . '$}i', $commands)) < 1) { |
|
699 | 699 | if (false !== $pos = strrpos($name, ':')) { |
700 | 700 | // check if a namespace exists and contains commands |
701 | 701 | $this->findNamespace(substr($name, 0, $pos)); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | |
706 | 706 | if ($alternatives = $this->findAlternatives($name, $allCommands)) { |
707 | 707 | // remove hidden commands |
708 | - $alternatives = array_filter($alternatives, function ($name) { |
|
708 | + $alternatives = array_filter($alternatives, function($name) { |
|
709 | 709 | return !$this->get($name)->isHidden(); |
710 | 710 | }); |
711 | 711 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | // filter out aliases for commands which are already on the list |
724 | 724 | if (\count($commands) > 1) { |
725 | 725 | $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; |
726 | - $commands = array_unique(array_filter($commands, function ($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
726 | + $commands = array_unique(array_filter($commands, function($nameOrAlias) use (&$commandList, $commands, &$aliases) { |
|
727 | 727 | if (!$commandList[$nameOrAlias] instanceof Command) { |
728 | 728 | $commandList[$nameOrAlias] = $this->commandLoader->get($nameOrAlias); |
729 | 729 | } |
@@ -743,16 +743,16 @@ discard block |
||
743 | 743 | foreach ($abbrevs as $abbrev) { |
744 | 744 | $maxLen = max(Helper::width($abbrev), $maxLen); |
745 | 745 | } |
746 | - $abbrevs = array_map(function ($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
746 | + $abbrevs = array_map(function($cmd) use ($commandList, $usableWidth, $maxLen, &$commands) { |
|
747 | 747 | if ($commandList[$cmd]->isHidden()) { |
748 | 748 | unset($commands[array_search($cmd, $commands)]); |
749 | 749 | |
750 | 750 | return false; |
751 | 751 | } |
752 | 752 | |
753 | - $abbrev = str_pad($cmd, $maxLen, ' ').' '.$commandList[$cmd]->getDescription(); |
|
753 | + $abbrev = str_pad($cmd, $maxLen, ' ') . ' ' . $commandList[$cmd]->getDescription(); |
|
754 | 754 | |
755 | - return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3).'...' : $abbrev; |
|
755 | + return Helper::width($abbrev) > $usableWidth ? Helper::substr($abbrev, 0, $usableWidth - 3) . '...' : $abbrev; |
|
756 | 756 | }, array_values($commands)); |
757 | 757 | |
758 | 758 | if (\count($commands) > 1) { |
@@ -851,15 +851,15 @@ discard block |
||
851 | 851 | $message = trim($e->getMessage()); |
852 | 852 | if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { |
853 | 853 | $class = get_debug_type($e); |
854 | - $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''); |
|
854 | + $title = sprintf(' [%s%s] ', $class, 0 !== ($code = $e->getCode()) ? ' (' . $code . ')' : ''); |
|
855 | 855 | $len = Helper::width($title); |
856 | 856 | } else { |
857 | 857 | $len = 0; |
858 | 858 | } |
859 | 859 | |
860 | 860 | if (str_contains($message, "@anonymous\0")) { |
861 | - $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function ($m) { |
|
862 | - return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class').'@anonymous' : $m[0]; |
|
861 | + $message = preg_replace_callback('/[a-zA-Z_\x7f-\xff][\\\\a-zA-Z0-9_\x7f-\xff]*+@anonymous\x00.*?\.php(?:0x?|:[0-9]++\$)[0-9a-fA-F]++/', function($m) { |
|
862 | + return class_exists($m[0], false) ? (get_parent_class($m[0]) ?: key(class_implements($m[0])) ?: 'class') . '@anonymous' : $m[0]; |
|
863 | 863 | }, $message); |
864 | 864 | } |
865 | 865 | |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $file = $trace[$i]['file'] ?? 'n/a'; |
912 | 912 | $line = $trace[$i]['line'] ?? 'n/a'; |
913 | 913 | |
914 | - $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type.$function.'()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
914 | + $output->writeln(sprintf(' %s%s at <info>%s:%s</info>', $class, $function ? $type . $function . '()' : '', $file, $line), OutputInterface::VERBOSITY_QUIET); |
|
915 | 915 | } |
916 | 916 | |
917 | 917 | $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | } |
974 | 974 | |
975 | 975 | if (\function_exists('putenv')) { |
976 | - @putenv('SHELL_VERBOSITY='.$shellVerbosity); |
|
976 | + @putenv('SHELL_VERBOSITY=' . $shellVerbosity); |
|
977 | 977 | } |
978 | 978 | $_ENV['SHELL_VERBOSITY'] = $shellVerbosity; |
979 | 979 | $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; |
@@ -1007,8 +1007,8 @@ discard block |
||
1007 | 1007 | $sttyMode = shell_exec('stty -g'); |
1008 | 1008 | |
1009 | 1009 | foreach ([\SIGINT, \SIGTERM] as $signal) { |
1010 | - $this->signalRegistry->register($signal, static function () use ($sttyMode) { |
|
1011 | - shell_exec('stty '.$sttyMode); |
|
1010 | + $this->signalRegistry->register($signal, static function() use ($sttyMode) { |
|
1011 | + shell_exec('stty ' . $sttyMode); |
|
1012 | 1012 | }); |
1013 | 1013 | } |
1014 | 1014 | } |
@@ -1018,7 +1018,7 @@ discard block |
||
1018 | 1018 | foreach ($this->signalsToDispatchEvent as $signal) { |
1019 | 1019 | $event = new ConsoleSignalEvent($command, $input, $output, $signal); |
1020 | 1020 | |
1021 | - $this->signalRegistry->register($signal, function ($signal, $hasNext) use ($event) { |
|
1021 | + $this->signalRegistry->register($signal, function($signal, $hasNext) use ($event) { |
|
1022 | 1022 | $this->dispatcher->dispatch($event, ConsoleEvents::SIGNAL); |
1023 | 1023 | |
1024 | 1024 | // No more handlers, we try to simulate PHP default behavior |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | { |
1099 | 1099 | return new InputDefinition([ |
1100 | 1100 | new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'), |
1101 | - new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>'.$this->defaultCommand.'</info> command'), |
|
1101 | + new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display help for the given command. When no command is given display help for the <info>' . $this->defaultCommand . '</info> command'), |
|
1102 | 1102 | new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'), |
1103 | 1103 | new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'), |
1104 | 1104 | new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'), |
@@ -1137,7 +1137,7 @@ discard block |
||
1137 | 1137 | */ |
1138 | 1138 | private function getAbbreviationSuggestions(array $abbrevs): string |
1139 | 1139 | { |
1140 | - return ' '.implode("\n ", $abbrevs); |
|
1140 | + return ' ' . implode("\n ", $abbrevs); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | /** |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | } |
1197 | 1197 | } |
1198 | 1198 | |
1199 | - $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; }); |
|
1199 | + $alternatives = array_filter($alternatives, function($lev) use ($threshold) { return $lev < 2 * $threshold; }); |
|
1200 | 1200 | ksort($alternatives, \SORT_NATURAL | \SORT_FLAG_CASE); |
1201 | 1201 | |
1202 | 1202 | return array_keys($alternatives); |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | |
1249 | 1249 | foreach (preg_split('//u', $m[0]) as $char) { |
1250 | 1250 | // test if $char could be appended to current line |
1251 | - if (mb_strwidth($line.$char, 'utf8') <= $width) { |
|
1251 | + if (mb_strwidth($line . $char, 'utf8') <= $width) { |
|
1252 | 1252 | $line .= $char; |
1253 | 1253 | continue; |
1254 | 1254 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
1278 | 1278 | |
1279 | 1279 | foreach ($parts as $part) { |
1280 | 1280 | if (\count($namespaces)) { |
1281 | - $namespaces[] = end($namespaces).':'.$part; |
|
1281 | + $namespaces[] = end($namespaces) . ':' . $part; |
|
1282 | 1282 | } else { |
1283 | 1283 | $namespaces[] = $part; |
1284 | 1284 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $shell = $input->getArgument('shell') ?? self::guessShell(); |
92 | - $completionFile = __DIR__.'/../Resources/completion.'.$shell; |
|
92 | + $completionFile = __DIR__ . '/../Resources/completion.' . $shell; |
|
93 | 93 | if (!file_exists($completionFile)) { |
94 | 94 | $supportedShells = $this->getSupportedShells(); |
95 | 95 | |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | |
118 | 118 | private function tailDebugLog(string $commandName, OutputInterface $output): void |
119 | 119 | { |
120 | - $debugFile = sys_get_temp_dir().'/sf_'.$commandName.'.log'; |
|
120 | + $debugFile = sys_get_temp_dir() . '/sf_' . $commandName . '.log'; |
|
121 | 121 | if (!file_exists($debugFile)) { |
122 | 122 | touch($debugFile); |
123 | 123 | } |
124 | 124 | $process = new Process(['tail', '-f', $debugFile], null, null, null, 0); |
125 | - $process->run(function (string $type, string $line) use ($output): void { |
|
125 | + $process->run(function(string $type, string $line) use ($output): void { |
|
126 | 126 | $output->write($line); |
127 | 127 | }); |
128 | 128 | } |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | */ |
133 | 133 | private function getSupportedShells(): array |
134 | 134 | { |
135 | - return array_map(function ($f) { |
|
135 | + return array_map(function($f) { |
|
136 | 136 | return pathinfo($f, \PATHINFO_EXTENSION); |
137 | - }, glob(__DIR__.'/../Resources/completion.*')); |
|
137 | + }, glob(__DIR__ . '/../Resources/completion.*')); |
|
138 | 138 | } |
139 | 139 | } |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | if ($titleLength > $limit = $markupLength - 4) { |
486 | 486 | $titleLength = $limit; |
487 | 487 | $formatLength = Helper::width(Helper::removeDecoration($formatter, sprintf($titleFormat, ''))); |
488 | - $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3).'...'); |
|
488 | + $formattedTitle = sprintf($titleFormat, Helper::substr($title, 0, $limit - $formatLength - 3) . '...'); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | $titleStart = intdiv($markupLength - $titleLength, 2); |
492 | 492 | if (false === mb_detect_encoding($markup, null, true)) { |
493 | 493 | $markup = substr_replace($markup, $formattedTitle, $titleStart, $titleLength); |
494 | 494 | } else { |
495 | - $markup = mb_substr($markup, 0, $titleStart).$formattedTitle.mb_substr($markup, $titleStart + $titleLength); |
|
495 | + $markup = mb_substr($markup, 0, $titleStart) . $formattedTitle . mb_substr($markup, $titleStart + $titleLength); |
|
496 | 496 | } |
497 | 497 | } |
498 | 498 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $cellFormat = $cell->getStyle()->getCellFormat(); |
568 | 568 | if (!\is_string($cellFormat)) { |
569 | 569 | $tag = http_build_query($cell->getStyle()->getTagOptions(), '', ';'); |
570 | - $cellFormat = '<'.$tag.'>%s</>'; |
|
570 | + $cellFormat = '<' . $tag . '>%s</>'; |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | if (strstr($content, '</>')) { |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | } |
641 | 641 | } |
642 | 642 | |
643 | - return new TableRows(function () use ($rows, $unmergedRows): \Traversable { |
|
643 | + return new TableRows(function() use ($rows, $unmergedRows): \Traversable { |
|
644 | 644 | foreach ($rows as $rowKey => $row) { |
645 | 645 | $rowGroup = [$row instanceof TableSeparator ? $row : $this->fillCells($row)]; |
646 | 646 |
@@ -251,18 +251,18 @@ |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | if ($currentLineLength) { |
254 | - $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n"; |
|
254 | + $prefix = substr($text, 0, $i = $width - $currentLineLength) . "\n"; |
|
255 | 255 | $text = substr($text, $i); |
256 | 256 | } else { |
257 | 257 | $prefix = ''; |
258 | 258 | } |
259 | 259 | |
260 | 260 | preg_match('~(\\n)$~', $text, $matches); |
261 | - $text = $prefix.preg_replace('~([^\\n]{'.$width.'})\\ *~', "\$1\n", $text); |
|
262 | - $text = rtrim($text, "\n").($matches[1] ?? ''); |
|
261 | + $text = $prefix . preg_replace('~([^\\n]{' . $width . '})\\ *~', "\$1\n", $text); |
|
262 | + $text = rtrim($text, "\n") . ($matches[1] ?? ''); |
|
263 | 263 | |
264 | 264 | if (!$currentLineLength && '' !== $current && "\n" !== substr($current, -1)) { |
265 | - $text = "\n".$text; |
|
265 | + $text = "\n" . $text; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | $lines = explode("\n", $text); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | |
136 | 136 | private function validate(string $content, int $flags, string $file = null) |
137 | 137 | { |
138 | - $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { |
|
138 | + $prevErrorHandler = set_error_handler(function($level, $message, $file, $line) use (&$prevErrorHandler) { |
|
139 | 139 | if (\E_USER_DEPRECATED === $level) { |
140 | 140 | throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); |
141 | 141 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | |
181 | 181 | foreach ($filesInfo as $info) { |
182 | 182 | if ($info['valid'] && $this->displayCorrectFiles) { |
183 | - $io->comment('<info>OK</info>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
183 | + $io->comment('<info>OK</info>' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
184 | 184 | } elseif (!$info['valid']) { |
185 | 185 | ++$erroredFiles; |
186 | - $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
186 | + $io->text('<error> ERROR </error>' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
187 | 187 | $io->text(sprintf('<error> >> %s</error>', $info['message'])); |
188 | 188 | |
189 | 189 | if (false !== strpos($info['message'], 'PARSE_CUSTOM_TAGS')) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | { |
210 | 210 | $errors = 0; |
211 | 211 | |
212 | - array_walk($filesInfo, function (&$v) use (&$errors) { |
|
212 | + array_walk($filesInfo, function(&$v) use (&$errors) { |
|
213 | 213 | $v['file'] = (string) $v['file']; |
214 | 214 | if (!$v['valid']) { |
215 | 215 | ++$errors; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | private function getDirectoryIterator(string $directory): iterable |
255 | 255 | { |
256 | - $default = function ($directory) { |
|
256 | + $default = function($directory) { |
|
257 | 257 | return new \RecursiveIteratorIterator( |
258 | 258 | new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS), |
259 | 259 | \RecursiveIteratorIterator::LEAVES_ONLY |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | |
270 | 270 | private function isReadable(string $fileOrDirectory): bool |
271 | 271 | { |
272 | - $default = function ($fileOrDirectory) { |
|
272 | + $default = function($fileOrDirectory) { |
|
273 | 273 | return is_readable($fileOrDirectory); |
274 | 274 | }; |
275 | 275 |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | $sequenceIndentation = \strlen($values['leadspaces']) + 1; |
183 | 183 | $sequenceYaml = substr($this->currentLine, $sequenceIndentation); |
184 | - $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); |
|
184 | + $sequenceYaml .= "\n" . $this->getNextEmbedBlock($sequenceIndentation, true); |
|
185 | 185 | |
186 | 186 | $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); |
187 | 187 | } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | isset($values['leadspaces']) |
197 | 197 | && ( |
198 | 198 | '!' === $values['value'][0] |
199 | - || self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['value']), $matches) |
|
199 | + || self::preg_match('#^(?P<key>' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['value']), $matches) |
|
200 | 200 | ) |
201 | 201 | ) { |
202 | 202 | // this is a compact notation element, add to next block and parse |
203 | 203 | $block = $values['value']; |
204 | 204 | if ($this->isNextLineIndented()) { |
205 | - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); |
|
205 | + $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | array_pop($this->refsBeingParsed); |
216 | 216 | } |
217 | 217 | } elseif ( |
218 | - self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) |
|
218 | + self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:' . Inline::REGEX_QUOTED_STRING . '|(?:!?!php/const:)?[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) |
|
219 | 219 | && (false === strpos($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) |
220 | 220 | ) { |
221 | 221 | if ($context && 'sequence' == $context) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | if (!\is_string($key) && !\is_int($key)) { |
236 | - throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string').' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); |
|
236 | + throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string') . ' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | // Convert float keys to strings, to avoid being converted to integers by PHP |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | return $this->refs[$value]; |
739 | 739 | } |
740 | 740 | |
741 | - if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { |
|
741 | + if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:' . self::TAG_PATTERN . ' +)?' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) { |
|
742 | 742 | $modifiers = $matches['modifiers'] ?? ''; |
743 | 743 | |
744 | 744 | $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers)); |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $value .= $lines[$i]; |
799 | 799 | $previousLineBlank = false; |
800 | 800 | } else { |
801 | - $value .= ' '.$lines[$i]; |
|
801 | + $value .= ' ' . $lines[$i]; |
|
802 | 802 | $previousLineBlank = false; |
803 | 803 | } |
804 | 804 | } |
@@ -901,11 +901,11 @@ discard block |
||
901 | 901 | $previousLineIndented = false; |
902 | 902 | $previousLineBlank = true; |
903 | 903 | } elseif (' ' === $blockLines[$i][0]) { |
904 | - $text .= "\n".$blockLines[$i]; |
|
904 | + $text .= "\n" . $blockLines[$i]; |
|
905 | 905 | $previousLineIndented = true; |
906 | 906 | $previousLineBlank = false; |
907 | 907 | } elseif ($previousLineIndented) { |
908 | - $text .= "\n".$blockLines[$i]; |
|
908 | + $text .= "\n" . $blockLines[$i]; |
|
909 | 909 | $previousLineIndented = false; |
910 | 910 | $previousLineBlank = false; |
911 | 911 | } elseif ($previousLineBlank || 0 === $i) { |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $previousLineIndented = false; |
914 | 914 | $previousLineBlank = false; |
915 | 915 | } else { |
916 | - $text .= ' '.$blockLines[$i]; |
|
916 | + $text .= ' ' . $blockLines[$i]; |
|
917 | 917 | $previousLineIndented = false; |
918 | 918 | $previousLineBlank = false; |
919 | 919 | } |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | |
1126 | 1126 | private function getLineTag(string $value, int $flags, bool $nextLineCheck = true): ?string |
1127 | 1127 | { |
1128 | - if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) { |
|
1128 | + if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^' . self::TAG_PATTERN . ' *( +#.*)?$/', $value, $matches)) { |
|
1129 | 1129 | return null; |
1130 | 1130 | } |
1131 | 1131 | |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | if ("'" === $quotation) { |
1175 | 1175 | $value .= '\\'; |
1176 | 1176 | } elseif (isset($this->currentLine[++$cursor])) { |
1177 | - $value .= '\\'.$this->currentLine[$cursor]; |
|
1177 | + $value .= '\\' . $this->currentLine[$cursor]; |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | break; |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | break; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | - return $value.$quotation; |
|
1189 | + return $value . $quotation; |
|
1190 | 1190 | default: |
1191 | 1191 | $value .= $this->currentLine[$cursor]; |
1192 | 1192 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) { |
60 | - $output .= $prefix.Inline::dump($input, $flags); |
|
60 | + $output .= $prefix . Inline::dump($input, $flags); |
|
61 | 61 | } else { |
62 | 62 | $dumpAsMap = Inline::isHash($input); |
63 | 63 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $blockChompingIndicator = '-'; |
80 | 80 | } |
81 | 81 | |
82 | - $output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); |
|
82 | + $output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); |
|
83 | 83 | |
84 | 84 | foreach (explode("\n", $value) as $row) { |
85 | 85 | if ('' === $row) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | if ($value instanceof TaggedValue) { |
96 | - $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); |
|
96 | + $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $value->getTag()); |
|
97 | 97 | |
98 | 98 | if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) { |
99 | 99 | // If the first line starts with a space character, the spec requires a blockIndicationIndicator |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | if ($inline - 1 <= 0 || null === $value->getValue() || is_scalar($value->getValue())) { |
112 | - $output .= ' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; |
|
112 | + $output .= ' ' . $this->dump($value->getValue(), $inline - 1, 0, $flags) . "\n"; |
|
113 | 113 | } else { |
114 | 114 | $output .= "\n"; |
115 | 115 | $output .= $this->dump($value->getValue(), $inline - 1, $dumpAsMap ? $indent + $this->indentation : $indent + 2, $flags); |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | |
129 | 129 | $output .= sprintf('%s%s%s%s', |
130 | 130 | $prefix, |
131 | - $dumpAsMap ? Inline::dump($key, $flags).':' : '-', |
|
131 | + $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', |
|
132 | 132 | $willBeInlined ? ' ' : "\n", |
133 | 133 | $this->dump($value, $inline - 1, $willBeInlined ? 0 : $indent + $this->indentation, $flags) |
134 | - ).($willBeInlined ? "\n" : ''); |
|
134 | + ) . ($willBeInlined ? "\n" : ''); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 |