fixed multilineIndent (#1669)

This commit is contained in:
Kevin Papst
2020-04-28 17:13:02 +02:00
committed by GitHub
parent 46a7b13293
commit ad2698dae2
9 changed files with 57 additions and 154 deletions

View File

@@ -105,16 +105,19 @@ class Extensions extends AbstractExtension
return '';
}
$parts = explode("\r\n", $string);
if (\count($parts) === 1) {
$parts = explode("\n", $string);
$parts = [];
foreach (explode("\r\n", $string) as $part) {
foreach (explode("\n", $part) as $tmp) {
$parts[] = $tmp;
}
}
$parts = array_map(function ($part) use ($indent) {
return $indent . $part;
}, $parts);
return implode("\n", $parts);
return implode(PHP_EOL, $parts);
}
/**