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

Use method return type as fallback in 2.x #7

Closed
codeliner opened this issue Feb 18, 2020 · 3 comments
Closed

Use method return type as fallback in 2.x #7

codeliner opened this issue Feb 18, 2020 · 3 comments

Comments

@codeliner
Copy link
Contributor

@arnedesmedt I had to change your PHP 7.4 implementation a bit, due to ReflectionType::__toString() being deprecated. See #6
I also added the exception back. Now it's thrown when the property has no type hint. However, we could also use the old logic (method return type) as a fallback in case no property type hint is given.
This would ease the migration path from 1.x to 2.x because you don't have to change all your ImmutableRecords at once. What do you think? Can you provide a PR for it and maybe also add some test cases?

@codeliner
Copy link
Contributor Author

Inspiration for tests can be found here: https://github.com/event-engine/php-json-schema/pull/7/files

@arnedesmedt
Copy link
Contributor

Oh, I forgot the deprecation of __toString(), sorry for that. I will add the fallback logic in a separate PR, with some tests.

@arnedesmedt
Copy link
Contributor

I've added a PR: #8

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