Skip to content
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

Consider adding support for type coercion #31

Open
natebrunette opened this issue Aug 8, 2018 · 2 comments
Open

Consider adding support for type coercion #31

natebrunette opened this issue Aug 8, 2018 · 2 comments

Comments

@natebrunette
Copy link
Member

No description provided.

@mattjanssen
Copy link

mattjanssen commented Jan 10, 2019

Yes, please! Is the only way to currently do this with custom type adapters? Like "StringToFloat" for example?

@natebrunette
Copy link
Member Author

natebrunette commented Jan 10, 2019

Currently, yes. I was struggling with how to implement it in a natural way. The two options I see are to create a new set of type adapters that do conversions is specific predetermined ways, or to pass a config value to the readers and skip throwing an exception if an unexpected type is found. This will rely on PHP casting the values to the expected value.

Edit: enabling this could conceal errors in the json as well if it can’t be done per field/class. But it gets more complicated to handle it on that level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants