Skip to content

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Aug 25, 2022

inspired by #1641 and #1579 (comment)

//cc @herndlm

Comment on lines +671 to +679
$callbackLeftType = $getTypeCallback($left);
$callbackRightType = $getTypeCallback($right);

if ($callbackLeftType instanceof NeverType || $callbackRightType instanceof NeverType) {
return new NeverType();
}

$leftTypes = TypeUtils::getConstantScalars($callbackLeftType);
$rightTypes = TypeUtils::getConstantScalars($callbackRightType);
Copy link
Contributor

@herndlm herndlm Aug 25, 2022

Choose a reason for hiding this comment

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

what do you think of also calling them $leftType and $rightType instead of $callbackLeftType and $callbackRightType? I think then it would be consistent with other methods from here

Copy link
Contributor Author

@staabm staabm Aug 25, 2022

Choose a reason for hiding this comment

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

it collides with a already same named variable in the loop below (therefore I went with callbackLeftType, as I used $leftType before and phpstan reported same named variables ;))

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, I missed that

@staabm staabm marked this pull request as ready for review August 25, 2022 08:54
@ondrejmirtes ondrejmirtes merged commit 992e7a4 into phpstan:1.8.x Aug 25, 2022
@ondrejmirtes
Copy link
Member

Thank you!

@staabm staabm deleted the never-ops branch August 25, 2022 12:57
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