Skip to content

Skip null checks when input is never null #502

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

Merged
merged 2 commits into from
May 3, 2023
Merged

Conversation

sanmai
Copy link

@sanmai sanmai commented Apr 25, 2023

The type is non-nullable.

Copy link
Collaborator

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised this wasn't checked by phpstan, as it usually catches issues like this. After looking into it, if I changed $input !== null to !is_null($input), phpstan does throw the warning. So for some reason PHPStan doesn't like the !==null .

Here's an interesting writeup on the differences between the two.

@bshaffer bshaffer merged commit d957f8e into firebase:main May 3, 2023
shenkimaro pushed a commit to shenkimaro/php-jwt that referenced this pull request May 30, 2023
shenkimaro pushed a commit to shenkimaro/php-jwt that referenced this pull request May 30, 2023
shenkimaro pushed a commit to shenkimaro/php-jwt that referenced this pull request Jul 7, 2023
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

Successfully merging this pull request may close these issues.

2 participants