Skip to content

Commit a20451e

Browse files
committed
[Yaml] Deprecate using the non-specific tag
1 parent c82fe60 commit a20451e

File tree

6 files changed

+20
-2
lines changed

6 files changed

+20
-2
lines changed

UPGRADE-3.4.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@ Finder
1010
------
1111

1212
* The `Symfony\Component\Finder\Iterator\FilterIterator` class has been
13-
deprecated and will be removed in 4.0 as it used to fix a bug which existed
13+
deprecated and will be removed in 4.0 as it used to fix a bug which existed
1414
before version 5.5.23/5.6.7.
1515

1616
Validator
1717
---------
1818

1919
* Not setting the `strict` option of the `Choice` constraint to `true` is
2020
deprecated and will throw an exception in Symfony 4.0.
21+
22+
Yaml
23+
----
24+
25+
* Using the non-specific tag `!` is deprecated and will have a different
26+
behavior in 4.0. Use a plain integer or `!!float` instead.

UPGRADE-4.0.md

+3
Original file line numberDiff line numberDiff line change
@@ -685,3 +685,6 @@ Yaml
685685

686686
* The constructor arguments `$offset`, `$totalNumberOfLines` and
687687
`$skippedLineNumbers` of the `Parser` class were removed.
688+
689+
* The behavior of the non-specific tag `!` is changed and now forces
690+
non-evaluating your values.

src/Symfony/Component/Yaml/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
CHANGELOG
22
=========
33

4+
3.4.0
5+
-----
6+
7+
* Deprecated using the non-specific tag `!` as its behavior will change in 4.0.
8+
It will force non-evaluating your values in 4.0. Use plain integers or `!!float` instead.
9+
410
3.3.0
511
-----
612

src/Symfony/Component/Yaml/Inline.php

+2
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,8 @@ private static function evaluateScalar($scalar, $flags, $references = array())
611611
case 0 === strpos($scalar, '!str'):
612612
return (string) substr($scalar, 5);
613613
case 0 === strpos($scalar, '! '):
614+
@trigger_error('Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0. It will force non-evaluating your values in 4.0. Use plain integers or !!float instead.', E_USER_DEPRECATED);
615+
614616
return (int) self::parseScalar(substr($scalar, 2), $flags);
615617
case 0 === strpos($scalar, '!php/object:'):
616618
if (self::$objectSupport) {

src/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml

+1
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ documents: 2
928928

929929
---
930930
test: Explicit typing
931+
deprecated: Using the non-specific tag "!" is deprecated since version 3.4 as its behavior will change in 4.0.
931932
yaml: |
932933
integer: 12
933934
also int: ! "12"

src/Symfony/Component/Yaml/Tests/ParserTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testSpecifications($expected, $yaml, $comment, $deprecated)
6161
restore_error_handler();
6262

6363
$this->assertCount(1, $deprecations);
64-
$this->assertContains('Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0.', $deprecations[0]);
64+
$this->assertContains(true !== $deprecated ? $deprecated : 'Using the comma as a group separator for floats is deprecated since version 3.2 and will be removed in 4.0.', $deprecations[0]);
6565
}
6666
}
6767

0 commit comments

Comments
 (0)