-
Notifications
You must be signed in to change notification settings - Fork 106
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
Labels
Infrastructure
Issues for the overall performance plugin infrastructure
[Type] Enhancement
A suggestion for improvement of an existing feature
Comments
westonruter
added
[Type] Enhancement
A suggestion for improvement of an existing feature
Infrastructure
Issues for the overall performance plugin infrastructure
labels
May 16, 2024
https://github.com/phpstan/phpstan-strict-rules Is your friend. Works like a charm |
But I said we were done with PHPStan PRs 😂 |
13 tasks
westonruter
changed the title
Add sniffs to disallow use of isset() and empty()
Add checks to disallow use of isset() and empty()
May 23, 2024
This was referenced Jul 24, 2024
github-project-automation
bot
moved this to Not Started/Backlog 📆
in WP Performance 2024
Aug 13, 2024
Per #1489 (comment), let's change this issue to be only about |
westonruter
changed the title
Add checks to disallow use of isset() and empty()
Add checks to disallow use of isset( $var ) and empty()
Aug 21, 2024
westonruter
changed the title
Add checks to disallow use of isset( $var ) and empty()
Add checks to disallow use of empty()
Nov 13, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Infrastructure
Issues for the overall performance plugin infrastructure
[Type] Enhancement
A suggestion for improvement of an existing feature
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: