@@ -88,7 +88,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
8888 $ isRef = $ isInPlace = $ isProcessed = false ;
8989 if (preg_match ('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#u ' , $ this ->currentLine , $ values )) {
9090 if ($ context && 'mapping ' == $ context ) {
91- throw new ParseException ('You cannot define a sequence item when in a mapping ' );
91+ throw new ParseException ('You cannot define a sequence item when in a mapping ' , $ this -> getRealCurrentLineNb () + 1 , $ this -> currentLine );
9292 }
9393 $ context = 'sequence ' ;
9494
@@ -127,7 +127,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
127127 }
128128 } elseif (preg_match ('#^(?P<key> ' .Inline::REGEX_QUOTED_STRING .'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u ' , $ this ->currentLine , $ values ) && (false === strpos ($ values ['key ' ], ' # ' ) || in_array ($ values ['key ' ][0 ], array ('" ' , "' " )))) {
129129 if ($ context && 'sequence ' == $ context ) {
130- throw new ParseException ('You cannot define a mapping item when in a sequence ' );
130+ throw new ParseException ('You cannot define a mapping item when in a sequence ' , $ this -> currentLineNb + 1 , $ this -> currentLine );
131131 }
132132 $ context = 'mapping ' ;
133133
@@ -214,7 +214,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
214214 } else {
215215 // multiple documents are not supported
216216 if ('--- ' === $ this ->currentLine ) {
217- throw new ParseException ('Multiple documents are not supported. ' );
217+ throw new ParseException ('Multiple documents are not supported. ' , $ this -> currentLineNb + 1 , $ this -> currentLine );
218218 }
219219
220220 // 1-liner optionally followed by newline(s)
@@ -449,7 +449,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport)
449449 }
450450
451451 if (!array_key_exists ($ value , $ this ->refs )) {
452- throw new ParseException (sprintf ('Reference "%s" does not exist. ' , $ value ), $ this
A194
->currentLine );
452+ throw new ParseException (sprintf ('Reference "%s" does not exist. ' , $ value ), $ this ->currentLineNb + 1 , $ this -> currentLine );
453453 }
454454
455455 return $ this ->refs [$ value ];
0 commit comments