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
Unexpected RedundantConditionGivenDocblockType
#3790
Labels
Comments
I found these snippets: https://psalm.dev/r/b4f8169f97<?php
/**
* @template T of mixed|false|null
* @param T $i
* @return (T is false ? no-return : T is null ? no-return : T)
*/
function orThrow($i) {
if ($i === false || $i === null) {
throw new RuntimeException("Example");
}
return $i;
}
/** @psalm-trace $var */
$var = orThrow(false);
|
Also, types inferred in |
I found these snippets: https://psalm.dev/r/eca2491cf6<?php
/**
* @template T of mixed|false|null
* @param T $i
* @return (T is false ? no-return : (T is null ? no-return : T))
*/
function orThrow($i) {
/** @psalm-trace $i */
$i;
if ($i === false) {
/** @psalm-trace $i */
$i;
throw new RuntimeException("Example");
}
if ($i === null) {
/** @psalm-trace $i */
$i;
throw new RuntimeException("Example");
}
/** @psalm-trace $i */
$i;
return $i;
}
/** @psalm-trace $var */
$var = orThrow(false);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems like the conditional here is a reasonable thing to do:
https://psalm.dev/r/b4f8169f97
The text was updated successfully, but these errors were encountered: