Skip to content

Narrow Predicate's fluent identifiers to what each predicate accepts - #224

Merged
simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/208-predicate-signatures
Oct 9, 2026
Merged

simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/208-predicate-signatures

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Fixes #208.

The fluent methods on Predicate accepted identifier types that the predicates they build reject, so those calls raised a TypeError inside the predicate constructor.

Changes

  • between() and notBetween() take string|ArgumentInterface|null for the identifier, and drop array from the min and max values.
  • equalTo(), notEqualTo(), lessThan(), lessThanOrEqualTo(), greaterThan() and greaterThanOrEqualTo() take string|ArgumentInterface|null for the left side.
  • in(), notIn(), isNull() and isNotNull() take string|ArgumentInterface for the identifier.
  • like() and notLike() take string|ArgumentInterface|null for the identifier.
  • A data-provided test checks that each fluent method's parameter types are a subset of its predicate constructor's.
  • docs/book/sql/where-having.md shows the narrowed signatures, and how to pass a value on the left as Argument\Value.

Breaking changes

  • The narrowed parameters reject int, float and array with a TypeError at the fluent method. Every such call already raised a TypeError one frame deeper, so no working call is affected.

mago format, mago lint, mago analyze and the unit tests pass.

between(), equalTo(), in(), isNull(), like() and their siblings
advertised int, float or array identifiers that the Between, Operator,
In, IsNull and Like constructors reject, so such calls raised a
TypeError one frame deeper. The fluent signatures now match, a test
compares each one against its predicate's constructor, and the API
listing in where-having.md shows the narrowed types.

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy simon-mundy added documentation Improvements or additions to documentation qa Improvements in quality assurance of the project Lang Feature Refactor Refactoring to new language features labels Oct 5, 2026
@simon-mundy simon-mundy added this to the 0.6.0 milestone Oct 5, 2026
@simon-mundy simon-mundy self-assigned this Oct 5, 2026
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…e-signatures

# Conflicts:
#	analyzer-baseline.toml
@simon-mundy
simon-mundy requested a review from tyrsson October 6, 2026 02:22
@simon-mundy
simon-mundy merged commit 5707d67 into php-db:0.6.x Oct 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Lang Feature Refactor Refactoring to new language features qa Improvements in quality assurance of the project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Predicate fluent methods accept identifier types their predicates reject

2 participants