Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a49af8

Browse files
feature #53680 [DependencyInjection][Yaml] dump enums with the !php/enum tag (xabbuh)
This PR was merged into the 7.1 branch. Discussion ---------- [DependencyInjection][Yaml] dump enums with the !php/enum tag | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | Fix #53636 | License | MIT Commits ------- 661cc42 dump enums with the !php/enum tag
2 parents 6190a8f + 661cc42 commit 4a49af8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/Yaml/Inline.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public static function dump(mixed $value, int $flags = 0): string
116116
default => 'Y-m-d\TH:i:s.uP',
117117
});
118118
case $value instanceof \UnitEnum:
119-
return sprintf('!php/const %s::%s', $value::class, $value->name);
119+
return sprintf('!php/enum %s::%s', $value::class, $value->name);
120120
case \is_object($value):
121121
if ($value instanceof TaggedValue) {
122122
return '!'.$value->getTag().' '.self::dump($value->getValue(), $flags);

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ public static function getNumericKeyData()
715715

716716
public function testDumpUnitEnum()
717717
{
718-
$this->assertSame("!php/const Symfony\Component\Yaml\Tests\Fixtures\FooUnitEnum::BAR", Inline::dump(FooUnitEnum::BAR));
718+
$this->assertSame("!php/enum Symfony\Component\Yaml\Tests\Fixtures\FooUnitEnum::BAR", Inline::dump(FooUnitEnum::BAR));
719719
}
720720

721721
public function testParseUnitEnum()

0 commit comments

Comments
 (0)