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

Rule to prefer !== null check over isset() for existing variable/key/property #171

Open
VincentLanglet opened this issue Apr 26, 2022 · 1 comment

Comments

@VincentLanglet
Copy link
Contributor

When using isset() we're checking that

  • The property/variable/... is defined
  • The value is not null

When the value is always defined, it could be clearer to write $foo !== null instead.

@dereuromark
Copy link
Contributor

dereuromark commented Nov 23, 2023

This is somewhat a code sniffer rule already for me.
But in PHPStan it would be easier or more correct to check the existence within a scope

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

2 participants