[Yaml] Deprecate using the object and const tag without a value

This commit is contained in:
Thomas Calvet 2020-01-16 20:30:36 +01:00
parent 74ac5421b2
commit 89062b9ba0
4 changed files with 18 additions and 0 deletions

View File

@ -40,3 +40,8 @@ Routing
-------
* Deprecated `RouteCollectionBuilder` in favor of `RoutingConfigurator`.
Yaml
----
* Deprecated using the `!php/object` and `!php/const` tags without a value.

View File

@ -5,6 +5,7 @@ CHANGELOG
-----
* Added `yaml-lint` binary.
* Deprecated using the `!php/object` and `!php/const` tags without a value.
5.0.0
-----

View File

@ -590,6 +590,8 @@ class Inline
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;
}
@ -604,6 +606,8 @@ class Inline
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 '';
}

View File

@ -740,6 +740,10 @@ class InlineTest extends TestCase
/**
* @dataProvider phpObjectTagWithEmptyValueProvider
*
* @group legacy
*
* @expectedDeprecation Using the !php/object tag without a value is deprecated since Symfony 5.1.
*/
public function testPhpObjectWithEmptyValue($expected, $value)
{
@ -760,6 +764,10 @@ class InlineTest extends TestCase
/**
* @dataProvider phpConstTagWithEmptyValueProvider
*
* @group legacy
*
* @expectedDeprecation Using the !php/const tag without a value is deprecated since Symfony 5.1.
*/
public function testPhpConstTagWithEmptyValue($expected, $value)
{