-
-
Notifications
You must be signed in to change notification settings - Fork 188
add example with constant as key #4441
base: main
Are you sure you want to change the base?
add example with constant as key #4441
Conversation
...former/tests/Converter/ConfigFormatConverter/YamlToPhp/Fixture/normal/workflow-constant.yaml
Outdated
Show resolved
Hide resolved
This looks much better 👏 |
…ter/YamlToPhp/Fixture/normal/workflow-constant.yaml Co-authored-by: Tomas Votruba <[email protected]>
I shortly analysed the problem the related code lines are:
Sadly I was not yet able to find a way to support all cases. Maybe someone else with better regex skill can make this work :) A Regex 101 link: https://regex101.com/r/gz7K1V/1 Expected: parameters:
class_constant: %const(Symplify\ConfigTransformer\Tests\Converter\ConfigFormatConverter\YamlToPhp\YamlToPhpTest::TEST)
class: %const(Symplify\ConfigTransformer\Tests\Converter\ConfigFormatConverter\YamlToPhp\YamlToPhpTest::class)
class2: %const(Symplify\ConfigTransformer\Tests\Converter\ConfigFormatConverter\YamlToPhp\YamlToPhpTest::class)
const: %const(PHP_INT_MAX)
const2: %const(PHP_INT_MAX)
unexisting_constant: %const(SomeClass::Constant)
- %const(PHP_INT_MAX: some_value)
- %const(App\Entity\Plant::TRANSITION_PLANT: some_value)
- %const(App\Entity\Plant::TRANSITION_TWO: some_value)
+ %const(PHP_INT_MAX): some_value
+ %const(App\Entity\Plant::TRANSITION_PLANT): some_value
+ %const(App\Entity\Plant::TRANSITION_TWO): some_value |
Check this one 😉 |
FWIW, const2, above, no longer works in 6.2.
That is, !php/const: no longer is allowed, the colon must be removed.
…On Wed, Nov 23, 2022 at 9:17 PM Grzegorz Korba ***@***.***> wrote:
Check this one <https://regex101.com/r/gz7K1V/2> 😉
[image: image]
<https://user-images.githubusercontent.com/600668/203679273-bf3f6e13-a56b-40b3-a6dc-8e8e2eeb1df9.png>
—
Reply to this email directly, view it on GitHub
<#4441 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEXIQI7HDFD77ZE65S76NLWJ3F27ANCNFSM6AAAAAARH72ZLU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@tacman Thx for th ehint, for the upgrade process to convert both need to be supported if somebody uses older version :) at the end it should both be converted to: ->set('transitions', [OurConstant::class => 'value']) |
@Wirone Nice, thank you 👍 do you want to create the pull request, don't want to steal your contribution :) |
@alexander-schranz do I understand correctly that such PR should provide changes in 2 files that you mentioned earlier (plus 3rd revision of the regex)? |
@Wirone the lines are in the same file. The regex need to be adopted and the lines where the regex it is used. And we should adopt existing tests or use the one provided here :) I sadly did not test it yet out if there are more changes required, but I don't think it. |
FYI: I did not add fixtures for constants use as keys, so @tacman can do it, but I suggest to merge #4484 first and then add such examples to But be aware, I tested it and I got: 😅 |
This is a shorter example. I think the issue is using a constant as the key, or maybe it's using a class constant rather than a PHP constant. Likely this test can be merged with constant.yaml.
Addresses #4436