-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[YAML] Added support for object-maps #10552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[YAML] Added support for object-maps #10552
Conversation
@@ -182,6 +192,48 @@ protected function getTestsForParse() | |||
); | |||
} | |||
|
|||
protected function getTestsForMapObjectParse() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably use a @dataProvider
here instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, the same should be done for getTestsForParse
then
I forked this a while ago so that I could get the changes into my project. It dawned on me that My changes are in this commit (polyfractal/Yaml@b0a08f3), we should probably add something similar to this PR. |
Code updated thanks! |
Awesome! Can't wait for this to be merged so I can stop maintaining a separate fork :) |
wonderful! 👍 |
👍 |
👍 also |
@nicolas-grekas you cannot give a +1 on your own PRs. It does not count :) |
@nicolas-grekas Can you rebase on current master? |
@nicolas-grekas lol. You 👍 your work ;) |
Well, it's @polyfractal's work, I only tried to cleanup the code in #10114 :-P |
if so, you could amend your commit to keep him as contributor ;) |
|
||
array('[ foo, [ bar, foo ] ]', array('foo', array('bar', 'foo'))), | ||
|
||
array('[{ foo: {bar: foo} }]', array((object) array('foo' => (object) array('bar' => 'foo')))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a // object as the other cases in L237 and stuff?
@lyrixx is ok, he has one commit and @polyfractal has the other commit. I believe is fair 😊 |
also could you please add documentation PR for this? |
Previously, the parser treated maps ( {} ) the same as sets ( [] ). Both were returned as PHP associative arrays. Since these are distinct entities, this can cause considerably problems for the users, especially when YAML is being serialized into another format such as JSON. This commit allows the user to enable object-map support via a third parameter on the Parse method. It defaults to `false`, which means that this commit does not break backwards compatibility. If the user enables object-map support, maps are represented by stdClass() objects. Sets remain as arrays.
@fabpot rebase done |
oups, I did not see it. gravatar are too small ;) |
…olas-grekas) This PR was merged into the 2.5-dev branch. Discussion ---------- [YAML] Added support for object-maps | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | NA | License | MIT | Doc PR | NA Proposal for #10114 Commits ------- 0cee604 [Yaml] Cleanups for object maps e2d5468 [Yaml] Added support for object maps
Woo! Thanks @nicolas-grekas for seeing this through and cleaning it up. Time to depreciate my temporary fork! :) |
Why does the object have to be on one line? Why is this not supported?
|
for anyone being interested: see #15700 |
Proposal for #10114