Skip to content

Use strict comparisons #976

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

Open
oliverklee opened this issue Feb 24, 2025 · 1 comment
Open

Use strict comparisons #976

oliverklee opened this issue Feb 24, 2025 · 1 comment

Comments

@oliverklee
Copy link
Contributor

We should make sure first that the changed code is covered with tests.

@JakeQZ
Copy link
Contributor

JakeQZ commented Feb 24, 2025

For reference, one instance is in DeclarationBlock::parse(), and was spotted during review of #972.

JakeQZ added a commit that referenced this issue Feb 25, 2025
The variable is either a string or it isn't.
The best practice for when it isn't is for it to be `null` or `unset()`.

Using `false` for when it isn't can lead to type-safety issues.
Reference:
https://vulke.medium.com/when-should-variables-be-null-false-undefined-or-an-empty-string-in-php-4ebd73c7a954

Also use `===` in a comparison in the affected code.

Resolves #975.
Part of #976.
oliverklee pushed a commit that referenced this issue Feb 25, 2025
…988)

The variable is either a string or it isn't.
The best practice for when it isn't is for it to be `null` or `unset()`.

Using `false` for when it isn't can lead to type-safety issues.
Reference:
https://vulke.medium.com/when-should-variables-be-null-false-undefined-or-an-empty-string-in-php-4ebd73c7a954

Also use `===` in a comparison in the affected code.

Resolves #975.
Part of #976.
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