-
-
Notifications
You must be signed in to change notification settings - Fork 120
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
conditional types do not take into account default values #2639
Labels
Comments
PHpactor also supports conditional return types, have you got an example of a conditional type that doesn't work? |
Interesting---I have this Laraval helper function that I was trying to add a condition return type to: if (! function_exists('logger')) {
/**
* Log a debug message to the logs.
*
* @param string|null $message
* @param array $context
* @return ($message is null ? \Illuminate\Log\LogManager : null)
*/
function logger($message = null, array $context = [])
{
if (is_null($message)) {
return app('log');
}
app('log')->debug($message, $context);
return null;
}
} But the variable appears to be It does seem to be picking up the return type in the docs though: |
thanks, updated title and added the bug label |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
PHPStan supports conditional return types---it would be great if phpactor could understand this. Currently it looks like these are just typed as
null
Thanks!
The text was updated successfully, but these errors were encountered: