We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The playground is broken, so the raw code:
$someVar = 'now'; $uppedDate = new DateTime($someVar); $diff = $uppedDate->diff(new DateTime()); $mdiff = (int)$diff->format('%m'); $ddiff = (int)$diff->format('%d'); $content = array_filter([$mdiff, $ddiff]); // if condition is always true if ($content) { die(); } // the error is gone if (\count($content) > 0) { die(); } $content = array_filter([$mdiff, $ddiff], fn(): bool => false); // the error is gone if ($content) { die(); }
count()
The text was updated successfully, but these errors were encountered:
Please reproduce it now.
Sorry, something went wrong.
The original code: https://phpstan.org/r/af2a9cfe-e058-47b5-a63f-b6d0eeb90709 Surprisingly, count() doesn't fix it.
Here is the more complicated (but closer to the original code w/ the issue) example: https://phpstan.org/r/4b5a185e-ec7a-4b38-a9ce-1a6e8be65a40 count() fixes it somehow
Fixed: phpstan/phpstan-src@d22abbe
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
The playground is broken, so the raw code:
count()
ing the result removes the error?The text was updated successfully, but these errors were encountered: