You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -476,7 +478,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
476
478
if (!isset($output[$key])) {
477
479
$output[$key] = $value;
478
480
} else {
479
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
481
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
480
482
}
481
483
$done = true;
482
484
break;
@@ -489,7 +491,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
489
491
if (!isset($output[$key])) {
490
492
$output[$key] = $value;
491
493
} else {
492
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
494
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
493
495
}
494
496
$done = true;
495
497
break;
@@ -504,7 +506,7 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
504
506
if (!isset($output[$key])) {
505
507
$output[$key] = $value;
506
508
} else {
507
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
509
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, self::$parsedLineNumber + 1), E_USER_DEPRECATED);
@@ -242,16 +243,18 @@ public function parse($value, $flags = 0)
242
243
if ($allowOverwrite || !isset($data[$key])) {
243
244
$data[$key] = null;
244
245
} else {
245
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
246
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);
246
247
}
247
248
} else {
249
+
// remember the parsed line number here in case we need it to provide some contexts in error messages below
// But overwriting is allowed when a merge node is used in current block.
251
254
if ($allowOverwrite || !isset($data[$key])) {
252
255
$data[$key] = $value;
253
256
} else {
254
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
257
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, $realCurrentLineNbKey + 1), E_USER_DEPRECATED);
255
258
}
256
259
}
257
260
} else {
@@ -261,7 +264,7 @@ public function parse($value, $flags = 0)
261
264
if ($allowOverwrite || !isset($data[$key])) {
262
265
$data[$key] = $value;
263
266
} else {
264
-
@trigger_error(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key), E_USER_DEPRECATED);
267
+
@trigger_error(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $key, $this->getRealCurrentLineNb() + 1), E_USER_DEPRECATED);
265
268
}
266
269
}
267
270
if ($isRef) {
@@ -276,6 +279,7 @@ public function parse($value, $flags = 0)
276
279
// 1-liner optionally followed by newline(s)
277
280
if (is_string($value) && $this->lines[0] === trim($value)) {
ErrorAssert::assertDeprecationsAreTriggered(sprintf('Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicates in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $duplicate_key), function () use ($input) {
818
+
ErrorAssert::assertDeprecationsAreTriggered(sprintf('Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0.', $duplicateKey, $lineNumber), function () use ($input) {
819
819
Yaml::parse($input);
820
820
});
821
821
}
@@ -827,25 +827,25 @@ public function getParseExceptionOnDuplicateData()
0 commit comments