@@ -216,14 +216,6 @@ private function updateData(array $newData)
216216 continue ;
217217 }
218218
219- if (
220- $ this ->isMultilineString ($ newVal )
221- && rtrim ($ currentVal , "\n" ) !== $ currentVal
222- && rtrim ($ newVal , "\n" ) === $ newVal
223- ) {
224- $ newVal .= "\n" ;
225- }
226-
227219 // 3b) value DID change
228220 $ this ->log (sprintf ('updating value to {%s} ' , \is_array ($ newVal ) ? '<array> ' : $ newVal ));
229221 $ this ->changeValueInYaml ($ newVal );
@@ -458,7 +450,6 @@ private function changeValueInYaml($value)
458450 $ endValuePosition = $ this ->findEndPositionOfValue ($ originalVal );
459451
460452 $ isMultilineValue = null !== $ this ->findPositionOfMultilineCharInLine ($ this ->currentPosition );
461- $ originalValEndsWithNewLine = $ isMultilineValue ? rtrim ($ originalVal , "\n" ) !== $ originalVal : false ;
462453
463454 // In case of multiline, $value is converted as plain string like "Foo\nBar"
464455 // We need to keep it "as is"
@@ -490,7 +481,7 @@ private function changeValueInYaml($value)
490481
491482 $ newContents = substr ($ this ->contents , 0 , $ this ->currentPosition )
492483 .($ isMultilineValue ? ' | ' : '' )
493- .( $ originalValEndsWithNewLine ? rtrim ( $ newYamlValue, ' ' ) : $ newYamlValue )
484+ .$ newYamlValue
494485 /*
495486 * If the next line is a comment, this means we probably had
496487 * a structure that looks like this:
@@ -806,7 +797,7 @@ private function findEndPositionOfValue($value, $offset = null)
806797 $ patternValue = $ quotedValue ;
807798
808799 // Iterates until we find a new line char or we reach end of file
809- if ($ this ->findPositionOfMultilineCharInLine ($ offset )) {
800+ if (null !== $ this ->findPositionOfMultilineCharInLine ($ offset )) {
810801 $ patternValue = str_replace (["\r\n" , "\n" ], '\r?\n\s* ' , $ quotedValue );
811802 }
812803
0 commit comments