-
Notifications
You must be signed in to change notification settings - Fork 651
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
DocblockTypeContradiction error creates incorrect type and wrong error #9038
Labels
Comments
I found these snippets: https://psalm.dev/r/abc33fab15<?php
/**
* @var int|float $init
*/
$foo = $init;
if ( is_int( $foo ) || !is_float( $foo ) ) {
/** @psalm-trace $foo */;
return;
}
/** @psalm-trace $foo */;
|
Reverse issue too https://psalm.dev/r/335b5aca9e |
I found these snippets: https://psalm.dev/r/335b5aca9e<?php
/**
* @param int|float $arg
* @return bool
*
* @psalm-assert-if-true int $arg
* @psalm-assert-if-false float $arg
*/
function is_int_or_float( $arg ) {
if ( is_int( $arg ) ) {
return true;
}
return false;
}
/**
* @var int|float $init
*/
$foo = $init;
if ( is_int_or_float( $foo ) ) {
/** @psalm-trace $foo */;
return;
}
/** @psalm-trace $foo */;
|
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 5, 2023
Closed
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 5, 2023
kkmuffme
added a commit
to kkmuffme/psalm
that referenced
this issue
Jan 8, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/abc33fab15
The first trace should be int - not int|float
The text was updated successfully, but these errors were encountered: