@@ -299,7 +299,7 @@ private function doParse(string $value, int $flags): mixed
299
299
if (!$ this ->isNextLineIndented () && !$ this ->isNextLineUnIndentedCollection ()) {
300
300
// Spec: Keys MUST be unique; first one wins.
301
301
// But overwriting is allowed when a merge node is used in current block.
302
- if ($ allowOverwrite || !isset ( $ data [ $ key] )) {
302
+ if ($ allowOverwrite || !\array_key_exists ( $ key, $ data )) {
303
303
if (null !== $ subTag ) {
304
304
$ data [$ key ] = new TaggedValue ($ subTag , '' );
305
305
} else {
@@ -320,7 +320,7 @@ private function doParse(string $value, int $flags): mixed
320
320
}
321
321
322
322
$ data += $ value ;
323
- } elseif ($ allowOverwrite || !isset ( $ data [ $ key] )) {
323
+ } elseif ($ allowOverwrite || !\array_key_exists ( $ key, $ data )) {
324
324
// Spec: Keys MUST be unique; first one wins.
325
325
// But overwriting is allowed when a merge node is used in current block.
326
326
if (null !== $ subTag ) {
@@ -336,7 +336,7 @@ private function doParse(string $value, int $flags): mixed
336
336
$ value = $ this ->parseValue (rtrim ($ values ['value ' ]), $ flags , $ context );
337
337
// Spec: Keys MUST be unique; first one wins.
338
338
// But overwriting is allowed when a merge node is used in current block.
339
- if ($ allowOverwrite || !isset ( $ data [ $ key] )) {
339
+ if ($ allowOverwrite || !\array_key_exists ( $ key, $ data )) {
340
340
$ data [$ key ] = $ value ;
341
341
} else {
342
342
throw new ParseException (sprintf ('Duplicate key "%s" detected. ' , $ key ), $ this ->getRealCurrentLineNb () + 1 , $ this ->currentLine );
0 commit comments