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

Unexpected RedundantCondition #10

Open
dzentota opened this issue Nov 15, 2021 · 1 comment
Open

Unexpected RedundantCondition #10

dzentota opened this issue Nov 15, 2021 · 1 comment

Comments

@dzentota
Copy link

Consider the following code:

<?php
function check(string $filename): bool
{
    if (strpos($filename, ".suback.php") !== false || strpos($filename, "_backup") !== false) {
        // we'll ignore .suback files, they are old upgrade backups
        return false;
    }
    return true;
}

The latest psalm/phar 4.12.0 returns:

ERROR: RedundantCondition - t.php:4:9 - int can never contain false (see https://psalm.dev/122)
if (strpos($filename, ".suback.php") !== false || strpos($filename, "_backup") !== false) {
ERROR: RedundantCondition - t.php:4:55 - int can never contain false (see https://psalm.dev/122)
if (strpos($filename, ".suback.php") !== false || strpos($filename, "_backup") !== false) {

While psalm.dev returns expected result

https://psalm.dev/r/0cc1635fe5

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/0cc1635fe5
<?php
function check(string $filename): bool
{
    if (strpos($filename, ".suback.php") !== false || strpos($filename, "_backup") !== false) {
        // we'll ignore .suback files, they are old upgrade backups
 		return false;
    }
    return true;
}
Psalm output (using commit 608e8d1):

No issues!

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

No branches or pull requests

1 participant