[Yaml] Remove line number in deprecation notices
This commit is contained in:
parent
99573dc45b
commit
f82b6185a4
@ -493,7 +493,7 @@ class Inline
|
||||
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags)) {
|
||||
$evaluatedKey = self::evaluateScalar($key, $flags, $references);
|
||||
|
||||
if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey)) {
|
||||
if ('' !== $key && $evaluatedKey !== $key && !is_string($evaluatedKey) && !is_int($evaluatedKey)) {
|
||||
@trigger_error('Implicit casting of incompatible mapping keys to strings is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.', E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ class Inline
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (isset($output[$key])) {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
$duplicate = true;
|
||||
}
|
||||
break;
|
||||
@ -530,7 +530,7 @@ class Inline
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (isset($output[$key])) {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
$duplicate = true;
|
||||
}
|
||||
break;
|
||||
@ -540,7 +540,7 @@ class Inline
|
||||
// Parser cannot abort this mapping earlier, since lines
|
||||
// are processed sequentially.
|
||||
if (isset($output[$key])) {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
$duplicate = true;
|
||||
}
|
||||
--$i;
|
||||
|
@ -236,9 +236,9 @@ class Parser
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags) && !is_string($key)) {
|
||||
$keyType = is_numeric($key) ? 'numeric key' : 'incompatible key type';
|
||||
@trigger_error(sprintf('Implicit casting of %s to string on line %d is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.', $keyType, $this->getRealCurrentLineNb()), E_USER_DEPRECATED);
|
||||
if (!(Yaml::PARSE_KEYS_AS_STRINGS & $flags) && !is_string($key) && !is_int($key)) {
|
||||
$keyType = is_numeric($key) ? 'numeric key' : 'non-string key';
|
||||
@trigger_error(sprintf('Implicit casting of %s to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.', $keyType), E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
// Convert float keys to strings, to avoid being converted to integers by PHP
|
||||
@ -312,7 +312,7 @@ class Parser
|
||||
$data[$key] = null;
|
||||
}
|
||||
} else {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
}
|
||||
} else {
|
||||
// remember the parsed line number here in case we need it to provide some contexts in error messages below
|
||||
@ -327,7 +327,7 @@ class Parser
|
||||
$data[$key] = $value;
|
||||
}
|
||||
} else {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -337,7 +337,7 @@ class Parser
|
||||
if ($allowOverwrite || !isset($data[$key])) {
|
||||
$data[$key] = $value;
|
||||
} else {
|
||||
@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);
|
||||
@trigger_error(sprintf('Duplicate key "%s" detected 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), E_USER_DEPRECATED);
|
||||
}
|
||||
}
|
||||
if ($isRef) {
|
||||
|
@ -853,7 +853,7 @@ EOD;
|
||||
/**
|
||||
* @group legacy
|
||||
* @dataProvider getParseExceptionOnDuplicateData
|
||||
* @expectedDeprecation Duplicate key "%s" detected on line %d whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated %s.
|
||||
* @expectedDeprecation Duplicate key "%s" detected whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated %s.
|
||||
* throws \Symfony\Component\Yaml\Exception\ParseException in 4.0
|
||||
*/
|
||||
public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber)
|
||||
@ -1081,7 +1081,7 @@ EOF;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Implicit casting of numeric key to string on line 1 is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
|
||||
* @expectedDeprecation Implicit casting of numeric key to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
|
||||
*/
|
||||
public function testFloatKeys()
|
||||
{
|
||||
@ -1103,7 +1103,7 @@ EOF;
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
* @expectedDeprecation Implicit casting of incompatible key type to string on line 1 is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
|
||||
* @expectedDeprecation Implicit casting of non-string key to string is deprecated since version 3.3 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0. Pass the PARSE_KEYS_AS_STRING flag to explicitly enable the type casts.
|
||||
*/
|
||||
public function testBooleanKeys()
|
||||
{
|
||||
|
Reference in New Issue
Block a user