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

Keep NeverType isExplicit-flag in InitializerExprTypeResolver #2114

Merged
merged 1 commit into from Dec 16, 2022

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Dec 15, 2022

similar to #2112

before this PR we lost the explicit-flag on NeverType, when expressions were used in arithmentic operations.
with the changes the explicit flag is preserved.

@staabm staabm marked this pull request as ready for review December 15, 2022 15:27
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

{
$initializerExprTypeResolver = self::getContainer()->getByType(InitializerExprTypeResolver::class);

$result = $initializerExprTypeResolver->getPlusType(
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 did only a single test as a representative for one operation.

should I test every single one?

Copy link
Member

Choose a reason for hiding this comment

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

That's fine.

Copy link
Member

Choose a reason for hiding this comment

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

But you should test all the branches obviously, ideally with a dataProvider. So when the left type is explicit, when the right type is explicit, and when none of them are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea. done.

@staabm staabm force-pushed the explicit-never branch 3 times, most recently from 9ab8618 to 332f6b4 Compare December 15, 2022 17:17
@ondrejmirtes ondrejmirtes merged commit 901d789 into phpstan:1.9.x Dec 16, 2022
@ondrejmirtes
Copy link
Member

Thank you.

@staabm staabm deleted the explicit-never branch December 16, 2022 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants