Skip to content

[Yaml] Dump stringable objects #57528

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

Closed
wants to merge 1 commit into from

Conversation

bradjones1
Copy link
Contributor

@bradjones1 bradjones1 commented Jun 26, 2024

Q A
Branch? 7.2
Bug fix? no
New feature? yes
Deprecations? no
License MIT

The YAML dumper should be able to respond to an object being Stringable and dump accordingly.

@bradjones1 bradjones1 requested a review from xabbuh as a code owner June 26, 2024 03:54
@carsonbot carsonbot added this to the 7.2 milestone Jun 26, 2024
@bradjones1 bradjones1 changed the title Dump stringable objects [Yaml] Dump stringable objects Jun 26, 2024
@bradjones1
Copy link
Contributor Author

Test failure appears to be from HEAD, not this change.

@symfony symfony deleted a comment from carsonbot Jun 26, 2024
@OskarStark
Copy link
Contributor

Can you please add a test case? thanks

@xabbuh
Copy link
Member

xabbuh commented Jun 27, 2024

I am not really convinced about adding this as it would mean that we would dump something that couldn't be parsed back into the object that we had before.

@derrabus
Copy link
Member

derrabus commented Jul 1, 2024

I share @xabbuh's concern. This PR makes the assumption that the string representation of an object is meant for serialization which is not necessarily the case.

@bradjones1
Copy link
Contributor Author

How about putting this behind an option flag as with other similar dumping alternatives?

@nicolas-grekas
Copy link
Member

An option flag might work, WDYT @xabbuh?

@xabbuh
Copy link
Member

xabbuh commented Aug 28, 2024

I am still not convinced that supporting to dump something that cannot be parsed back into the initial structure is a good idea. But in any case making this an opt-in feature would be a must-have.

@fabpot fabpot modified the milestones: 7.2, 7.3 Nov 20, 2024
@fabpot
Copy link
Member

fabpot commented Mar 29, 2025

Closing as 2 core team members expressed valid concerns about this PR.

@fabpot fabpot closed this Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants