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

fix: better return type inference when reading the body of relation methods #533

Merged
merged 1 commit into from
Apr 16, 2020
Merged

Conversation

canvural
Copy link
Collaborator

Related to #531

This PR provides better support for return types of relations methods when reading their body.

cc @ondrejmirtes

Copy link
Contributor

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one thing :) Otherwise 👍 (if it works form an integration PoV)

src/Types/RelationParserHelper.php Show resolved Hide resolved
@canvural
Copy link
Collaborator Author

Is there a point of caching the result of analyzing the method body, in the extension? Or the performance gain would be negligible?

@ondrejmirtes
Copy link
Contributor

@canvural I don't cache it in phpstan-doctrine and it's fine. You can do a simple in-memory cache by an array in private property if you're concerned. That way, the AST will not be traversed multiple times looking for the same method during the same PHPStan run.

@canvural
Copy link
Collaborator Author

@ondrejmirtes Yeah, that was what I had in mind. Simple array in the extension with filename and method name as the key.

But first, we can go without it, and if we see some issues we can add it later.

Thank you for the review!

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.

None yet

2 participants