8000 [Yaml] deprecate parsing mappings without keys · symfony/symfony@703e810 · GitHub
[go: up one dir, main page]

Skip to content

Commit 703e810

Browse files
committed
[Yaml] deprecate parsing mappings without keys
1 parent 1804b2d commit 703e810

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

UPGRADE-3.3.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ Workflow
119119
Yaml
120120
----
121121

122+
* Omitting the key of a mapping is deprecated and will lead to a `ParseException` in Symfony 4.0.
123+
122124
* The constructor arguments `$offset`, `$totalNumberOfLines` and
123125
`$skippedLineNumbers` of the `Parser` class are deprecated and will be
124126
removed in 4.0

UPGRADE-4.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ Validator
340340
Yaml
341341
----
342342

343+
* Omitting the key of a mapping is not supported anymore and throws a `ParseException`.
344+
343345
* Mappings with a colon (`:`) that is not followed by a whitespace are not
344346
supported anymore and lead to a `ParseException`(e.g. `foo:bar` must be
345347
`foo: bar`).

src/Symfony/Component/Yaml/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
3.3.0
5+
-----
6+
7+
* Omitting the key of a mapping is deprecated and will lead to a `ParseException` in Symfony 4.0.
8+
49
3.2.0
510
-----
611

src/Symfony/Component/Yaml/Inline.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,10 @@ private static function parseMapping($mapping, $flags, &$i = 0, $references = ar
481481
break;
482482
}
483483

484+
if (':' === $key) {
485+
@trigger_error('Omitting the key of a mapping is deprecated and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
486+
}
487+
484488
if (':' !== $key && (!isset($mapping[$i + 1]) || !in_array($mapping[$i + 1], array(' ', ',', '[', ']', '{', '}'), true))) {
485489
@trigger_error('Using a colon that is not followed by an indication character (i.e. " ", ",", "[", "]", "{", "}" is deprecated since version 3.2 and will throw a ParseException in 4.0.', E_USER_DEPRECATED);
486490
}

0 commit comments

Comments
 (0)
0