-
Notifications
You must be signed in to change notification settings - Fork 431
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
Simplify arrow-function return type inference #2873
Conversation
Arrow-functions can't have a void return type
74d8202
to
48420bf
Compare
@@ -1242,7 +1242,7 @@ private function resolveType(string $exprString, Expr $node): Type | |||
new VoidType(), | |||
]); | |||
} else { | |||
$returnType = $arrowScope->getKeepVoidType($node->expr); | |||
$returnType = $arrowScope->getType($node->expr); | |||
if ($node->returnType !== null) { | |||
$returnType = TypehintHelper::decideType($this->getFunctionType($node->returnType, false, false), $returnType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I came to the conclusion that getKeepVoidType
might not be necessary because the following IF did not keep void when infered from $node->returnType
either
This pull request has been marked as ready for review. |
//cc @herndlm |
If no tests were failing before, and this doesn't fix anything, what is the purpose of this change? |
Its a line of code which did not make sense to me while looking thru functionType stuff. I have no concrete case in mind - feel free to close |
If it ain't broke don't fix it :) But when testing a piece of code I found a false negative on 1.10.x: |
Arrow-functions can't have a void return type
refs #2778 (comment)