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

Add ClosureTypeFactory #1483

Merged
merged 1 commit into from Jun 30, 2022
Merged

Conversation

canvural
Copy link
Contributor

From the discussion.

This PR adds new class ClosureTypeFactory that can create ClosureType from native Closures.

This PR doesn't descent into closure body to determine return type like MutatingScope does, but for this use case it should be fine.

return [
[static function (): void {
}, 'void'],
[static function () { // @phpcs:ignore
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wanted to test a case where there is no native return type, but phpcbf was adding void. Needed to ignore it here.

@ondrejmirtes ondrejmirtes merged commit 55ab8b9 into phpstan:1.8.x Jun 30, 2022
@ondrejmirtes
Copy link
Member

Perfect, thank you!

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