Skip to content

chore(phpstan): give SqlFilterEquals native parameter types - #1897

Merged
JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan
Nov 10, 2026
Merged

JohnVillalovos merged 1 commit into
developfrom
jlvillal/phpstan

Conversation

@JohnVillalovos

Copy link
Copy Markdown
Collaborator

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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 BaseSqlFilter values as mixed.
  • 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

Comment thread lib/Database/SqlFilter.php Resolved
Comment thread lib/Database/SqlFilter.php Resolved
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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are identified for the SQL filter type, documentation, and null-handling changes described.

No open issues 🎉

2 resolved since last review

Review effort: Lite

@JohnVillalovos
JohnVillalovos merged commit fdf766a into develop Nov 10, 2026
18 checks passed
@JohnVillalovos
JohnVillalovos deleted the jlvillal/phpstan branch November 10, 2026 07:13
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