@@ -88,7 +88,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
88
88
$ isRef = $ isInPlace = $ isProcessed = false ;
89
89
if (preg_match ('#^\-((?P<leadspaces>\s+)(?P<value>.+?))?\s*$#u ' , $ this ->currentLine , $ values )) {
90
90
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 );
92
92
}
93
93
$ context = 'sequence ' ;
94
94
@@ -127,7 +127,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
127
127
}
128
128
} 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 ('" ' , "' " )))) {
129
129
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 );
131
131
}
132
132
$ context = 'mapping ' ;
133
133
@@ -214,7 +214,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
214
214
} else {
215
215
// multiple documents are not supported
216
216
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 );
218
218
}
219
219
220
220
// 1-liner optionally followed by newline(s)
@@ -449,7 +449,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport)
449
449
}
450
450
451
451
if (!array_key_exists ($ value , $ this ->refs )) {
452
- throw new ParseException (sprintf ('Reference "%s" does not exist. ' , $ value ), $ this ->currentLine );
452
+ throw new ParseException (sprintf ('Reference "%s" does not exist. ' , $ value ), $ this ->currentLineNb + 1 , $ this -> currentLine );
453
453
}
454
454
455
455
return $ this ->refs [$ value ];
0 commit comments