Upgrade to 3.9.5
This commit is contained in:
28
kirby/vendor/symfony/yaml/Dumper.php
vendored
28
kirby/vendor/symfony/yaml/Dumper.php
vendored
@@ -69,9 +69,7 @@ class Dumper
|
||||
}
|
||||
|
||||
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value) && false !== strpos($value, "\n") && false === strpos($value, "\r")) {
|
||||
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
||||
$blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
|
||||
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value);
|
||||
|
||||
if (isset($value[-2]) && "\n" === $value[-2] && "\n" === $value[-1]) {
|
||||
$blockChompingIndicator = '+';
|
||||
@@ -98,9 +96,7 @@ class Dumper
|
||||
$output .= sprintf('%s%s !%s', $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', $value->getTag());
|
||||
|
||||
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
|
||||
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
||||
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
|
||||
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue());
|
||||
$output .= sprintf(' |%s', $blockIndentationIndicator);
|
||||
|
||||
foreach (explode("\n", $value->getValue()) as $row) {
|
||||
@@ -145,9 +141,7 @@ class Dumper
|
||||
$output = sprintf('%s!%s', $prefix ? $prefix.' ' : '', $value->getTag());
|
||||
|
||||
if (Yaml::DUMP_MULTI_LINE_LITERAL_BLOCK & $flags && \is_string($value->getValue()) && false !== strpos($value->getValue(), "\n") && false === strpos($value->getValue(), "\r\n")) {
|
||||
// If the first line starts with a space character, the spec requires a blockIndicationIndicator
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
||||
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
|
||||
$blockIndentationIndicator = $this->getBlockIndentationIndicator($value->getValue());
|
||||
$output .= sprintf(' |%s', $blockIndentationIndicator);
|
||||
|
||||
foreach (explode("\n", $value->getValue()) as $row) {
|
||||
@@ -163,4 +157,20 @@ class Dumper
|
||||
|
||||
return $output."\n".$this->dump($value->getValue(), $inline - 1, $indent, $flags);
|
||||
}
|
||||
|
||||
private function getBlockIndentationIndicator(string $value): string
|
||||
{
|
||||
$lines = explode("\n", $value);
|
||||
|
||||
// If the first line (that is neither empty nor contains only spaces)
|
||||
// starts with a space character, the spec requires a block indentation indicator
|
||||
// http://www.yaml.org/spec/1.2/spec.html#id2793979
|
||||
foreach ($lines as $line) {
|
||||
if ('' !== trim($line, ' ')) {
|
||||
return (' ' === substr($line, 0, 1)) ? (string) $this->indentation : '';
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user