8000 feature #35368 [Yaml] Deprecate using the object and const tag withou… · symfony/symfony@80b003f · GitHub
[go: up one dir, main page]

Skip to content

Commit 80b003f

Browse files
committed
feature #35368 [Yaml] Deprecate using the object and const tag without a value (fancyweb)
This PR was merged into the 5.1-dev branch. Discussion ---------- [Yaml] Deprecate using the object and const tag without a value | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | #35332 (comment) | License | MIT | Doc PR | - WIP because it needs 3.4 merged up into master + #35332. Commits ------- 89062b9 [Yaml] Deprecate using the object and const tag without a value
2 parents 74ac542 + 89062b9 commit 80b003f

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

UPGRADE-5.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,8 @@ Routing
4040
-------
4141

4242
* Deprecated `RouteCollectionBuilder` in favor of `RoutingConfigurator`.
43+
44+
Yaml
45+
----
46+
47+
* Deprecated using the `!php/object` and `!php/const` tags without a value.

src/Symfony/Component/Yaml/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

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

910
5.0.0
1011
-----

src/Symfony/Component/Yaml/Inline.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ private static function evaluateScalar(string $scalar, int $flags, array $refere
590590
case 0 === strpos($scalar, '!php/object'):
591591
if (self::$objectSupport) {
592592
if (!isset($scalar[12])) {
593+
@trigger_error('Using the !php/object tag without a value is deprecated since Symfony 5.1.', E_USER_DEPRECATED);
594+
593595
return false;
594596
}
595597

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

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,10 @@ public function getTestsForOctalNumbers()
740740

741741
/**
742742
* @dataProvider phpObjectTagWithEmptyValueProvider
743+
*
744+
* @group legacy
745+
*
746+
* @expectedDeprecation Using the !php/object tag without a value is deprecated since Symfony 5.1.
743747
*/
744748
public function testPhpObjectWithEmptyValue($expected, $value)
745749
{
@@ -760,6 +764,10 @@ public function phpObjectTagWithEmptyValueProvider()
760764

761765
/**
762766
* @dataProvider phpConstTagWithEmptyValueProvider
767+
*
768+
* @group legacy
769+
*
770+
* @expectedDeprecation Using the !php/const tag without a value is deprecated since Symfony 5.1.
763771
*/
764772
public function testPhpConstTagWithEmptyValue($expected, $value)
765773
{

0 commit comments

Comments
 (0)
0