Skip to content

Conversation

rvanvelzen
Copy link
Contributor

Resolves phpstan/phpstan#7124. Parameter types could in fact already be conditional when using template types, this just implements the same logic as used for return types.

To improve error messages for conditional types in general they're resolved immediately now (when possible)

Copy link
Member

Choose a reason for hiding this comment

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

Please assert which errors are happening here.

Copy link
Member

Choose a reason for hiding this comment

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

What? :) You're asserting the same thing to different values.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I was day dreaming a bit when moving some code around 😅

@rvanvelzen rvanvelzen force-pushed the conditional-parameter branch from 81b7b66 to be17f0a Compare April 29, 2022 09:53
@rvanvelzen
Copy link
Contributor Author

I've refactored "late resolvable types" a bit to make it more future-proof. Stuff like offset access types can reuse much of the logic.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you re-add this stuff intentionally or was it a bad merge/rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely a bad merge

@rvanvelzen rvanvelzen force-pushed the conditional-parameter branch from 1b7da5f to 465867b Compare April 29, 2022 10:19
@ondrejmirtes
Copy link
Member

Nice cleanup, I really like it :) Thank you!

@ondrejmirtes ondrejmirtes force-pushed the conditional-parameter branch from 8c62388 to 76a48db Compare May 3, 2022 15:44
@ondrejmirtes ondrejmirtes merged commit 8ad35b3 into phpstan:1.6.x May 3, 2022
@rvanvelzen rvanvelzen deleted the conditional-parameter branch May 17, 2022 09:51
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.

3 participants