-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add checks to disallow use of empty() #1219
Comments
https://github.com/phpstan/phpstan-strict-rules Is your friend. Works like a charm |
But I said we were done with PHPStan PRs 😂 |
Per #1489 (comment), let's change this issue to be only about |
Since strict rules are now applied with Lines 68 to 75 in b6e5c5a
Either we go ahead and close this issue as complete or we eliminate the use of |
If we were to consider eliminating the use of |
One PR is fine for me. But if the changes end up being too massive, then separate PRs would make sense too. |
Feature Description
The use of
empty()
andisset( $var )
can mask code problems (e.g. typos). And they rarely need to be used, for example:cf. comment by @felixarntz in #1091 (comment)
We should consider adding sniffs to warn against their use. (Granted, PHPStan should catch the problematic uses of
isset()
andempty()
.)The text was updated successfully, but these errors were encountered: