- $parsedValue = Inline::parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
+ $quotation = '' !== $value && ('"' === $value[0] || "'" === $value[0]) ? $value[0] : null;
+
+ // do not take following lines into account when the current line is a quoted single line value
+ if (null !== $quotation && preg_match('/^'.$quotation.'.*'.$quotation.'(\s*#.*)?$/', $value)) {
+ return Inline::parse($value, $flags, $this->refs);
+ }
+
+ while ($this->moveToNextLine()) {
+ // unquoted strings end before the first unindented line
+ if (null === $quotation && $this->getCurrentLineIndentation() === 0) {
+ $this->moveToPreviousLine();
+
+ break;
+ }
+
+ $value .= ' '.trim($this->currentLine);
+
+ // quoted string values end with a line that is terminated with the quotation character
+ if ('' !== $this->currentLine && substr($this->currentLine, -1) === $quotation) {
+ break;
+ }
+ }