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

Add checks to disallow use of isset() and empty() #1219

Open
westonruter opened this issue May 16, 2024 · 2 comments · May be fixed by #1241
Open

Add checks to disallow use of isset() and empty() #1219

westonruter opened this issue May 16, 2024 · 2 comments · May be fixed by #1241
Labels
Infrastructure Issues for the overall performance plugin infrastructure [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@westonruter
Copy link
Member

westonruter commented May 16, 2024

Feature Description

The use of empty() and isset() 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() and empty().)

@westonruter westonruter added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall performance plugin infrastructure labels May 16, 2024
@swissspidy
Copy link
Member

https://github.com/phpstan/phpstan-strict-rules Is your friend.

Works like a charm

@westonruter
Copy link
Member Author

But I said we were done with PHPStan PRs 😂

@westonruter westonruter linked a pull request May 23, 2024 that will close this issue
13 tasks
@westonruter 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
@westonruter westonruter added this to the performance-lab 3.2.0 milestone May 23, 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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants