Skip to content
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

Wrong type for variable checked with is_long #9384

Closed
ygottschalk opened this issue Feb 23, 2023 · 1 comment · Fixed by #9385
Closed

Wrong type for variable checked with is_long #9384

ygottschalk opened this issue Feb 23, 2023 · 1 comment · Fixed by #9385

Comments

@ygottschalk
Copy link
Contributor

Documentation lists is_long() as an alias of is_int. Checking the type of a variable with is_long gives float instead of int.
See: https://psalm.dev/r/a362f0e861
Documentation: https://www.php.net/manual/en/function.is-long (and https://www.php.net/manual/en/aliases.php)

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/a362f0e861
<?php

/**
@param mixed $i
 */
function takesAnInt($i): void {
    if (is_int($i)) {
        /** @psalm-trace $i */
    }
    if (is_long($i)) {
        /** @psalm-trace $i */
    }
}
Psalm output (using commit e96a929):

INFO: Trace - 8:0 - $i: int

INFO: Trace - 11:0 - $i: float

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 a pull request may close this issue.

1 participant