Repository navigation
chore(phpstan): give SqlFilterEquals native parameter types - #1897
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Approval is blocked by two critical issues: integer 0 is incorrectly treated as NULL, and the narrowed value type conflicts with existing mixed-valued callers.
2 open issues
What changed in this PR
Updates SQL filter constructor signatures and documentation to accurately represent the values used by equality and inequality filters, improving PHPStan type analysis.
Changes:
- Documents
BaseSqlFiltervalues asmixed. - Adds native union types to
SqlFilterEquals, including nullable values. - Adds native parameter types to
SqlFilterNotEquals.
| File | Description |
|---|---|
| lib/Database/SqlFilter.php | Updates SQL filter constructor documentation and native parameter type declarations for equality and inequality filters. |
Review effort: Lite
SqlFilterEquals is called with ISqlFilterColumn subclasses (SqlRepeatingFilterColumn), integer ids, and null (to produce IS NULL), but its PHPDoc claimed SqlFilterColumn|string and string. Declare the real types natively on SqlFilterEquals and SqlFilterNotEquals and document BaseSqlFilter's value as mixed. Now that integer values are part of the contract, use a strict null check in SqlFilterEquals::GetSql() so an integer 0 compares as a value instead of producing IS NULL, and add regression tests. Assisted-by: Claude:claude-opus-5-5
JohnVillalovos
force-pushed
the
jlvillal/phpstan
branch
from
November 10, 2026 07:08
f6dfa8e to
d1650de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

SqlFilterEquals is called with ISqlFilterColumn subclasses (SqlRepeatingFilterColumn), integer ids, and null (to produce IS NULL), but its PHPDoc claimed SqlFilterColumn|string and string. Declare the real types natively on SqlFilterEquals and SqlFilterNotEquals and document BaseSqlFilter's value as mixed.
Assisted-by: Claude:claude-opus-5-5