Skip to content

Add ClosureTypeFactory#1483

Merged
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
canvural:from-closure-object
Jun 30, 2022
Merged

Add ClosureTypeFactory#1483
ondrejmirtes merged 1 commit intophpstan:1.8.xfrom
canvural:from-closure-object

Conversation

@canvural
Copy link
Copy Markdown
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.

Copy link
Copy Markdown
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.

@canvural canvural force-pushed the from-closure-object branch from 4cb5434 to 49966a9 Compare June 30, 2022 12:49
@ondrejmirtes ondrejmirtes merged commit 55ab8b9 into phpstan:1.8.x Jun 30, 2022
@ondrejmirtes
Copy link
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

2 participants