Skip to content

refactor: Query Builder WHERE/HAVING condition handling#10217

Open
memleakd wants to merge 1 commit into
codeigniter4:4.8from
memleakd:refactor/query-builder-condition-compiler
Open

refactor: Query Builder WHERE/HAVING condition handling#10217
memleakd wants to merge 1 commit into
codeigniter4:4.8from
memleakd:refactor/query-builder-condition-compiler

Conversation

@memleakd
Copy link
Copy Markdown
Contributor

Description

This PR proposes refactoring the internal Query Builder handling for WHERE and HAVING conditions without changing public APIs or expected SQL output.

The existing condition-building paths each handled parts of prefixing, grouping, and compilation themselves. This centralizes those pieces into small private helpers so the behavior is easier to follow and safer to maintain.

It also adds regression coverage for a few important condition cases:

  • LIKE with a bound value
  • = null compiling to IS NULL
  • != null compiling to IS NOT NULL

This is intentionally a behavior-preserving cleanup. No new user-facing API is added, so there is no user guide or changelog entry.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

- Route WHERE/HAVING condition insertion through shared prefix handling
- Extract WHERE/HAVING condition compilation into focused private helpers
- Add regression coverage for operator and null condition handling
- Reduce the BaseBuilder empty() PHPStan baseline count

Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
@github-actions github-actions Bot added the 4.8 PRs that target the `4.8` branch. label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant