Skip to content

Commit 2737f35

Browse files
committed
Use explode instead of preg_split because no need of regex
1 parent f7584ca commit 2737f35

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Symfony/Component/Yaml/Dumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0)
105105
$blockIndentationIndicator = (' ' === substr($value, 0, 1)) ? (string) $this->indentation : '';
106106
$output .= sprintf("%s%s%s |%s\n", $prefix, $dumpAsMap ? Inline::dump($key, $flags).':' : '-', '', $blockIndentationIndicator);
107107

108-
foreach (preg_split('/\n/', $value) as $row) {
108+
foreach (explode("\n", $value) as $row) {
109109
$output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
110110
}
111111

@@ -121,7 +121,7 @@ public function dump($input, $inline = 0, $indent = 0, $flags = 0)
121121
$blockIndentationIndicator = (' ' === substr($value->getValue(), 0, 1)) ? (string) $this->indentation : '';
122122
$output .= sprintf(" |%s\n", $blockIndentationIndicator);
123123

124-
foreach (preg_split('/\n/', $value->getValue()) as $row) {
124+
foreach (explode("\n", $value->getValue()) as $row) {
125125
$output .= sprintf("%s%s%s\n", $prefix, str_repeat(' ', $this->indentation), $row);
126126
}
127127

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy