Skip to content

Conversation

@rene-bos
Copy link
Contributor

@rene-bos rene-bos commented Jan 6, 2023

Only supported if the existing PHPDoc return type is the same as the native return type. This way we ensure that we don't change types.

Not updating of another type was already covered with a test. I added a test for the case when we can update the PHPDoc with only the generics.

Only supported if the existing PHPDoc return type is the same as the native return type.
This way we ensure that we don't change types.
@rene-bos
Copy link
Contributor Author

rene-bos commented Jan 6, 2023

Forgot to run PHPStan local before the last commit, will fix tomorrow.

@rene-bos rene-bos marked this pull request as draft January 6, 2023 19:28
@rene-bos rene-bos marked this pull request as ready for review January 7, 2023 15:15
@rene-bos
Copy link
Contributor Author

rene-bos commented Jan 9, 2023

@driftingly This rule is ready to get reviewed (and hopefully to get merged!). I'm working on a further improvement of this rule which is build on top of this PR. I will prepare the PR if this one merged. That PR will fix the generics for BelongsTo and MorphTo, which both need a TChildModel specified.

@driftingly driftingly merged commit db97ae1 into driftingly:main Feb 6, 2023
@driftingly
Copy link
Owner

Thanks @rene-bos!

@rene-bos rene-bos deleted the support-updating-existing-return-docblock-with-generics branch February 6, 2023 18:44
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

Successfully merging this pull request may close these issues.

2 participants