Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature #46771 [Yaml] Add support for
!php/enum *->value
syntax (ni…
…colas-grekas) This PR was merged into the 6.2 branch. Discussion ---------- [Yaml] Add support for `!php/enum *->value` syntax | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #44203 and the likes | License | MIT | Doc PR | - This PR allows one to use the following Yaml together with enums: ```yaml - !php/enum SomeEnum::Bar - !php/enum SomeEnum::Bar->value ``` The first line gets the `SomeEnum::Bar` instance. It's the same as writing `!php/const SomeEnum::Bar` but with an additional check that this is really an enum. The second line is the one that is really needed as it allows referencing the value backed by an enum, which is something that is not possible currently. Commits ------- f71e4ab [Yaml] Add support for `!php/enum *->value` syntax
- Loading branch information
Showing
4 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
CHANGELOG | ||
========= | ||
|
||
6.2 | ||
--- | ||
|
||
* Add support for `!php/enum` and `!php/enum *->value` | ||
|
||
6.1 | ||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
namespace Symfony\Component\Yaml\Tests\Fixtures; | ||
|
||
enum FooBackedEnum: string | ||
{ | ||
case BAR = 'bar'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters