@@ -227,18 +227,18 @@ |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | if ($currentLineLength) { |
| 230 | - $prefix = substr($text, 0, $i = $width - $currentLineLength)."\n"; |
|
| 230 | + $prefix = substr($text, 0, $i = $width - $currentLineLength) . "\n"; |
|
| 231 | 231 | $text = substr($text, $i); |
| 232 | 232 | } else { |
| 233 | 233 | $prefix = ''; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | preg_match('~(\\n)$~', $text, $matches); |
| 237 | - $text = $prefix.$this->addLineBreaks($text, $width); |
|
| 238 | - $text = rtrim($text, "\n").($matches[1] ?? ''); |
|
| 237 | + $text = $prefix . $this->addLineBreaks($text, $width); |
|
| 238 | + $text = rtrim($text, "\n") . ($matches[1] ?? ''); |
|
| 239 | 239 | |
| 240 | 240 | if (!$currentLineLength && '' !== $current && !str_ends_with($current, "\n")) { |
| 241 | - $text = "\n".$text; |
|
| 241 | + $text = "\n" . $text; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | $lines = explode("\n", $text); |
@@ -23,14 +23,14 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $values = []; |
| 25 | 25 | foreach ($suggestions->getValueSuggestions() as $value) { |
| 26 | - $values[] = $value->getValue().($value->getDescription() ? "\t".$value->getDescription() : ''); |
|
| 26 | + $values[] = $value->getValue() . ($value->getDescription() ? "\t" . $value->getDescription() : ''); |
|
| 27 | 27 | } |
| 28 | 28 | foreach ($suggestions->getOptionSuggestions() as $option) { |
| 29 | - $values[] = '--'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : ''); |
|
| 29 | + $values[] = '--' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : ''); |
|
| 30 | 30 | if ($option->isNegatable()) { |
| 31 | - $values[] = '--no-'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : ''); |
|
| 31 | + $values[] = '--no-' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : ''); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | - $output->write(implode("\n", $values)."\n"); |
|
| 34 | + $output->write(implode("\n", $values) . "\n"); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -23,12 +23,12 @@ |
||
| 23 | 23 | { |
| 24 | 24 | $values = []; |
| 25 | 25 | foreach ($suggestions->getValueSuggestions() as $value) { |
| 26 | - $values[] = $value->getValue().($value->getDescription() ? "\t".$value->getDescription() : ''); |
|
| 26 | + $values[] = $value->getValue() . ($value->getDescription() ? "\t" . $value->getDescription() : ''); |
|
| 27 | 27 | } |
| 28 | 28 | foreach ($suggestions->getOptionSuggestions() as $option) { |
| 29 | - $values[] = '--'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : ''); |
|
| 29 | + $values[] = '--' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : ''); |
|
| 30 | 30 | if ($option->isNegatable()) { |
| 31 | - $values[] = '--no-'.$option->getName().($option->getDescription() ? "\t".$option->getDescription() : ''); |
|
| 31 | + $values[] = '--no-' . $option->getName() . ($option->getDescription() ? "\t" . $option->getDescription() : ''); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | $output->write(implode("\n", $values)); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @return $this |
| 30 | 30 | */ |
| 31 | - public function suggestValue(string|Suggestion $value): static |
|
| 31 | + public function suggestValue(string | Suggestion $value): static |
|
| 32 | 32 | { |
| 33 | 33 | $this->valueSuggestions[] = !$value instanceof Suggestion ? new Suggestion($value) : $value; |
| 34 | 34 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | private function validate(string $content, int $flags, ?string $file = null): array |
| 128 | 128 | { |
| 129 | - $prevErrorHandler = set_error_handler(function ($level, $message, $file, $line) use (&$prevErrorHandler) { |
|
| 129 | + $prevErrorHandler = set_error_handler(function($level, $message, $file, $line) use (&$prevErrorHandler) { |
|
| 130 | 130 | if (\E_USER_DEPRECATED === $level) { |
| 131 | 131 | throw new ParseException($message, $this->getParser()->getRealCurrentLineNb() + 1); |
| 132 | 132 | } |
@@ -167,10 +167,10 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | foreach ($filesInfo as $info) { |
| 169 | 169 | if ($info['valid'] && $this->displayCorrectFiles) { |
| 170 | - $io->comment('<info>OK</info>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
| 170 | + $io->comment('<info>OK</info>' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
| 171 | 171 | } elseif (!$info['valid']) { |
| 172 | 172 | ++$erroredFiles; |
| 173 | - $io->text('<error> ERROR </error>'.($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
| 173 | + $io->text('<error> ERROR </error>' . ($info['file'] ? sprintf(' in %s', $info['file']) : '')); |
|
| 174 | 174 | $io->text(sprintf('<error> >> %s</error>', $info['message'])); |
| 175 | 175 | |
| 176 | 176 | if (str_contains($info['message'], 'PARSE_CUSTOM_TAGS')) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | { |
| 197 | 197 | $errors = 0; |
| 198 | 198 | |
| 199 | - array_walk($filesInfo, function (&$v) use (&$errors) { |
|
| 199 | + array_walk($filesInfo, function(&$v) use (&$errors) { |
|
| 200 | 200 | $v['file'] = (string) $v['file']; |
| 201 | 201 | if (!$v['valid']) { |
| 202 | 202 | ++$errors; |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | return sprintf('!php/enum %s::%s', $value::class, $value->name); |
| 120 | 120 | case \is_object($value): |
| 121 | 121 | if ($value instanceof TaggedValue) { |
| 122 | - return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags); |
|
| 122 | + return '!' . $value->getTag() . ' ' . self::dump($value->getValue(), $flags); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if (Yaml::DUMP_OBJECT & $flags) { |
| 126 | - return '!php/object '.self::dump(serialize($value)); |
|
| 126 | + return '!php/object ' . self::dump(serialize($value)); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \stdClass || $value instanceof \ArrayObject)) { |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | case '' == $value: |
| 172 | 172 | return "''"; |
| 173 | 173 | case self::isBinaryString($value): |
| 174 | - return '!!binary '.base64_encode($value); |
|
| 174 | + return '!!binary ' . base64_encode($value); |
|
| 175 | 175 | case Escaper::requiresDoubleQuoting($value): |
| 176 | 176 | return Escaper::escapeWithDoubleQuotes($value); |
| 177 | 177 | case Escaper::requiresSingleQuoting($value): |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * Check if given array is hash or just normal indexed array. |
| 197 | 197 | */ |
| 198 | - public static function isHash(array|\ArrayObject|\stdClass $value): bool |
|
| 198 | + public static function isHash(array | \ArrayObject | \stdClass $value): bool |
|
| 199 | 199 | { |
| 200 | 200 | if ($value instanceof \stdClass || $value instanceof \ArrayObject) { |
| 201 | 201 | return true; |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | * @param array|\ArrayObject|\stdClass $value The hash array to dump |
| 240 | 240 | * @param int $flags A bit field of Yaml::DUMP_* constants to customize the dumped YAML string |
| 241 | 241 | */ |
| 242 | - private static function dumpHashArray(array|\ArrayObject|\stdClass $value, int $flags): string |
|
| 242 | + private static function dumpHashArray(array | \ArrayObject | \stdClass $value, int $flags): string |
|
| 243 | 243 | { |
| 244 | 244 | $output = []; |
| 245 | 245 | foreach ($value as $key => $val) { |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | if (Parser::preg_match('/[ \t]+#/', $output, $match, \PREG_OFFSET_CAPTURE)) { |
| 296 | 296 | $output = substr($output, 0, $match[0][1]); |
| 297 | 297 | } |
| 298 | - } elseif (Parser::preg_match('/^(.*?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) { |
|
| 298 | + } elseif (Parser::preg_match('/^(.*?)(' . implode('|', $delimiters) . ')/', substr($scalar, $i), $match)) { |
|
| 299 | 299 | $output = $match[1]; |
| 300 | 300 | $i += \strlen($output); |
| 301 | 301 | $output = trim($output); |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | private static function parseQuotedScalar(string $scalar, int &$i = 0): string |
| 325 | 325 | { |
| 326 | - if (!Parser::preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { |
|
| 326 | + if (!Parser::preg_match('/' . self::REGEX_QUOTED_STRING . '/Au', substr($scalar, $i), $match)) { |
|
| 327 | 327 | throw new ParseException(sprintf('Malformed inline YAML string: "%s".', substr($scalar, $i)), self::$parsedLineNumber + 1, $scalar, self::$parsedFilename); |
| 328 | 328 | } |
| 329 | 329 | |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | // embedded mapping? |
| 389 | 389 | try { |
| 390 | 390 | $pos = 0; |
| 391 | - $value = self::parseMapping('{'.$value.'}', $flags, $pos, $references); |
|
| 391 | + $value = self::parseMapping('{' . $value . '}', $flags, $pos, $references); |
|
| 392 | 392 | } catch (\InvalidArgumentException) { |
| 393 | 393 | // no, it's not |
| 394 | 394 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | * |
| 421 | 421 | * @throws ParseException When malformed inline YAML string is parsed |
| 422 | 422 | */ |
| 423 | - private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []): array|\stdClass |
|
| 423 | + private static function parseMapping(string $mapping, int $flags, int &$i = 0, array &$references = []): array | \stdClass |
|
| 424 | 424 | { |
| 425 | 425 | $output = []; |
| 426 | 426 | $len = \strlen($mapping); |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | if ('!php/const' === $key || '!php/enum' === $key) { |
| 456 | - $key .= ' '.self::parseScalar($mapping, $flags, [':'], $i, false); |
|
| 456 | + $key .= ' ' . self::parseScalar($mapping, $flags, [':'], $i, false); |
|
| 457 | 457 | $key = self::evaluateScalar($key, $flags); |
| 458 | 458 | } |
| 459 | 459 | |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | case Parser::preg_match(self::getHexRegex(), $scalar): |
| 716 | 716 | $scalar = str_replace('_', '', $scalar); |
| 717 | 717 | |
| 718 | - return '0x' === $scalar[0].$scalar[1] ? hexdec($scalar) : (float) $scalar; |
|
| 718 | + return '0x' === $scalar[0] . $scalar[1] ? hexdec($scalar) : (float) $scalar; |
|
| 719 | 719 | case '.inf' === $scalarLower: |
| 720 | 720 | case '.nan' === $scalarLower: |
| 721 | 721 | return -log(0); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | |
| 165 | 165 | $sequenceIndentation = \strlen($values['leadspaces']) + 1; |
| 166 | 166 | $sequenceYaml = substr($this->currentLine, $sequenceIndentation); |
| 167 | - $sequenceYaml .= "\n".$this->getNextEmbedBlock($sequenceIndentation, true); |
|
| 167 | + $sequenceYaml .= "\n" . $this->getNextEmbedBlock($sequenceIndentation, true); |
|
| 168 | 168 | |
| 169 | 169 | $data[] = $this->parseBlock($currentLineNumber, rtrim($sequenceYaml), $flags); |
| 170 | 170 | } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || str_starts_with(ltrim($values['value'], ' '), '#')) { |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | isset($values['leadspaces']) |
| 180 | 180 | && ( |
| 181 | 181 | '!' === $values['value'][0] |
| 182 | - || self::preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['value']), $matches) |
|
| 182 | + || self::preg_match('#^(?P<key>' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\{\[].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->trimTag($values['value']), $matches) |
|
| 183 | 183 | ) |
| 184 | 184 | ) { |
| 185 | 185 | $block = $values['value']; |
| 186 | 186 | if ($this->isNextLineIndented() || isset($matches['value']) && '>-' === $matches['value']) { |
| 187 | - $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); |
|
| 187 | + $block .= "\n" . $this->getNextEmbedBlock($this->getCurrentLineIndentation() + \strlen($values['leadspaces']) + 1); |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $flags); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | array_pop($this->refsBeingParsed); |
| 198 | 198 | } |
| 199 | 199 | } elseif ( |
| 200 | - self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) |
|
| 200 | + self::preg_match('#^(?P<key>(?:![^\s]++\s++)?(?:' . Inline::REGEX_QUOTED_STRING . '|[^ \'"\[\{!].*?)) *\:(( |\t)++(?P<value>.+))?$#u', rtrim($this->currentLine), $values) |
|
| 201 | 201 | && (!str_contains($values['key'], ' #') || \in_array($values['key'][0], ['"', "'"])) |
| 202 | 202 | ) { |
| 203 | 203 | if ($context && 'sequence' == $context) { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | if (!\is_string($key) && !\is_int($key)) { |
| 218 | - throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string').' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); |
|
| 218 | + throw new ParseException((is_numeric($key) ? 'Numeric' : 'Non-string') . ' keys are not supported. Quote your evaluable mapping keys instead.', $this->getRealCurrentLineNb() + 1, $this->currentLine); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | // Convert float keys to strings, to avoid being converted to integers by PHP |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | return $this->refs[$value]; |
| 716 | 716 | } |
| 717 | 717 | |
| 718 | - if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:'.self::TAG_PATTERN.' +)?'.self::BLOCK_SCALAR_HEADER_PATTERN.'$/', $value, $matches)) { |
|
| 718 | + if (\in_array($value[0], ['!', '|', '>'], true) && self::preg_match('/^(?:' . self::TAG_PATTERN . ' +)?' . self::BLOCK_SCALAR_HEADER_PATTERN . '$/', $value, $matches)) { |
|
| 719 | 719 | $modifiers = $matches['modifiers'] ?? ''; |
| 720 | 720 | |
| 721 | 721 | $data = $this->parseBlockScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers)); |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | $value .= $lines[$i]; |
| 776 | 776 | $previousLineBlank = false; |
| 777 | 777 | } else { |
| 778 | - $value .= ' '.$lines[$i]; |
|
| 778 | + $value .= ' ' . $lines[$i]; |
|
| 779 | 779 | $previousLineBlank = false; |
| 780 | 780 | } |
| 781 | 781 | } |
@@ -878,11 +878,11 @@ discard block |
||
| 878 | 878 | $previousLineIndented = false; |
| 879 | 879 | $previousLineBlank = true; |
| 880 | 880 | } elseif (' ' === $blockLines[$i][0]) { |
| 881 | - $text .= "\n".$blockLines[$i]; |
|
| 881 | + $text .= "\n" . $blockLines[$i]; |
|
| 882 | 882 | $previousLineIndented = true; |
| 883 | 883 | $previousLineBlank = false; |
| 884 | 884 | } elseif ($previousLineIndented) { |
| 885 | - $text .= "\n".$blockLines[$i]; |
|
| 885 | + $text .= "\n" . $blockLines[$i]; |
|
| 886 | 886 | $previousLineIndented = false; |
| 887 | 887 | $previousLineBlank = false; |
| 888 | 888 | } elseif ($previousLineBlank || 0 === $i) { |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | $previousLineIndented = false; |
| 891 | 891 | $previousLineBlank = false; |
| 892 | 892 | } else { |
| 893 | - $text .= ' '.$blockLines[$i]; |
|
| 893 | + $text .= ' ' . $blockLines[$i]; |
|
| 894 | 894 | $previousLineIndented = false; |
| 895 | 895 | $previousLineBlank = false; |
| 896 | 896 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | |
| 1065 | 1065 | private function getLineTag(string $value, int $flags, bool $nextLineCheck = true): ?string |
| 1066 | 1066 | { |
| 1067 | - if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^'.self::TAG_PATTERN.' *( +#.*)?$/', $value, $matches)) { |
|
| 1067 | + if ('' === $value || '!' !== $value[0] || 1 !== self::preg_match('/^' . self::TAG_PATTERN . ' *( +#.*)?$/', $value, $matches)) { |
|
| 1068 | 1068 | return null; |
| 1069 | 1069 | } |
| 1070 | 1070 | |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | if ("'" === $quotation) { |
| 1114 | 1114 | $value .= '\\'; |
| 1115 | 1115 | } elseif (isset($this->currentLine[++$cursor])) { |
| 1116 | - $value .= '\\'.$this->currentLine[$cursor]; |
|
| 1116 | + $value .= '\\' . $this->currentLine[$cursor]; |
|
| 1117 | 1117 | } |
| 1118 | 1118 | |
| 1119 | 1119 | break; |
@@ -1125,7 +1125,7 @@ discard block |
||
| 1125 | 1125 | break; |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | - return $value.$quotation; |
|
| 1128 | + return $value . $quotation; |
|
| 1129 | 1129 | default: |
| 1130 | 1130 | $value .= $this->currentLine[$cursor]; |
| 1131 | 1131 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || !$input) { |
| 58 | - $output .= $prefix.Inline::dump($input, $flags); |
|
| 58 | + $output .= $prefix . Inline::dump($input, $flags); |
|
| 59 | 59 | } elseif ($input instanceof TaggedValue) { |
| 60 | 60 | $output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix); |
| 61 | 61 | } else { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $blockChompingIndicator = '-'; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); |
|
| 84 | + $output .= sprintf('%s%s%s |%s%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', '', $blockIndentationIndicator, $blockChompingIndicator); |
|
| 85 | 85 | |
| 86 | 86 | foreach (explode("\n", $value) as $row) { |
| 87 | 87 | if ('' === $row) { |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ($value instanceof TaggedValue) { |
| 98 | - $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag()); |
|
| 98 | + $output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags) . ':' : '-', $value->getTag()); |
|
| 99 | 99 | |
| 100 | 100 | if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { |
| 101 | 101 | $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); |
@@ -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 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | private function dumpTaggedValue(TaggedValue $value, int $inline, int $indent, int $flags, string $prefix): string |
| 142 | 142 | { |
| 143 | - $output = sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag()); |
|
| 143 | + $output = sprintf('%s!%s', $prefix ? $prefix . ' ' : '', $value->getTag()); |
|
| 144 | 144 | |
| 145 | 145 | if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && str_contains($value->getValue(), "\n") && !str_contains($value->getValue(), "\r\n")) { |
| 146 | 146 | $blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue()); |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | if ($inline - 1 <= 0 || null === $value->getValue() || \is_scalar($value->getValue())) { |
| 157 | - return $output.' '.$this->dump($value->getValue(), $inline - 1, 0, $flags)."\n"; |
|
| 157 | + return $output . ' ' . $this->dump($value->getValue(), $inline - 1, 0, $flags) . "\n"; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - return $output."\n".$this->dump($value->getValue(), $inline - 1, $indent, $flags); |
|
| 160 | + return $output . "\n" . $this->dump($value->getValue(), $inline - 1, $indent, $flags); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | private function getBlockIndentationIndicator(string $value): string |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | $callback = fn ($match) => $this->unescapeCharacter($match[0]); |
| 49 | 49 | |
| 50 | 50 | // evaluate the string |
| 51 | - return preg_replace_callback('/'.self::REGEX_ESCAPED_CHARACTER.'/u', $callback, $value); |
|
| 51 | + return preg_replace_callback('/' . self::REGEX_ESCAPED_CHARACTER . '/u', $callback, $value); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | return \chr($c); |
| 98 | 98 | } |
| 99 | 99 | if (0x800 > $c) { |
| 100 | - return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); |
|
| 100 | + return \chr(0xC0 | $c >> 6) . \chr(0x80 | $c & 0x3F); |
|
| 101 | 101 | } |
| 102 | 102 | if (0x10000 > $c) { |
| 103 | - return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); |
|
| 103 | + return \chr(0xE0 | $c >> 12) . \chr(0x80 | $c >> 6 & 0x3F) . \chr(0x80 | $c & 0x3F); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - return \chr(0xF0 | $c >> 18).\chr(0x80 | $c >> 12 & 0x3F).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); |
|
| 106 | + return \chr(0xF0 | $c >> 18) . \chr(0x80 | $c >> 12 & 0x3F) . \chr(0x80 | $c >> 6 & 0x3F) . \chr(0x80 | $c & 0x3F); |
|
| 107 | 107 | } |
| 108 | 108 | } |