Skip to content

Commit

Permalink
[Yaml] Deprecate using the object and const tag without a value
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyweb committed Feb 3, 2020
1 parent 74ac542 commit 89062b9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions UPGRADE-5.1.md
Expand Up @@ -40,3 +40,8 @@ Routing
-------

* Deprecated `RouteCollectionBuilder` in favor of `RoutingConfigurator`.

Yaml
----

* Deprecated using the `!php/object` and `!php/const` tags without a value.
1 change: 1 addition & 0 deletions src/Symfony/Component/Yaml/CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* Added `yaml-lint` binary.
* Deprecated using the `!php/object` and `!php/const` tags without a value.

5.0.0
-----
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Yaml/Inline.php
Expand Up @@ -590,6 +590,8 @@ private static function evaluateScalar(string $scalar, int $flags, array $refere
case 0 === strpos($scalar, '!php/object'):
if (self::$objectSupport) {
if (!isset($scalar[12])) {
@trigger_error('Using the !php/object tag without a value is deprecated since Symfony 5.1.', E_USER_DEPRECATED);

return false;
}

Expand All @@ -604,6 +606,8 @@ private static function evaluateScalar(string $scalar, int $flags, array $refere
case 0 === strpos($scalar, '!php/const'):
if (self::$constantSupport) {
if (!isset($scalar[11])) {
@trigger_error('Using the !php/const tag without a value is deprecated since Symfony 5.1.', E_USER_DEPRECATED);

return '';
}

Expand Down
8 changes: 8 additions & 0 deletions src/Symfony/Component/Yaml/Tests/InlineTest.php
Expand Up @@ -740,6 +740,10 @@ public function getTestsForOctalNumbers()

/**
* @dataProvider phpObjectTagWithEmptyValueProvider
*
* @group legacy
*
* @expectedDeprecation Using the !php/object tag without a value is deprecated since Symfony 5.1.
*/
public function testPhpObjectWithEmptyValue($expected, $value)
{
Expand All @@ -760,6 +764,10 @@ public function phpObjectTagWithEmptyValueProvider()

/**
* @dataProvider phpConstTagWithEmptyValueProvider
*
* @group legacy
*
* @expectedDeprecation Using the !php/const tag without a value is deprecated since Symfony 5.1.
*/
public function testPhpConstTagWithEmptyValue($expected, $value)
{
Expand Down

0 comments on commit 89062b9

Please sign in to comment.