Skip to content

fix(builder,model): narrow string|callable type hints to string|Closure#56

Merged
benkhalife merged 1 commit into
mainfrom
fix/callable-typehint-ide-false-positive
Jun 17, 2026
Merged

fix(builder,model): narrow string|callable type hints to string|Closure#56
benkhalife merged 1 commit into
mainfrom
fix/callable-typehint-ide-false-positive

Conversation

@benkhalife

Copy link
Copy Markdown
Member

The where(), orWhere(), join() family, and Model::where() accepted callable in a union with string, even though the implementation only ever checks instanceof \Closure. Static analyzers (Intelephense and similar) treat a callable parameter as a potential function-name reference, so passing a plain column name like 'page_id' triggered a false "Call to unknown function" diagnostic in the IDE.

Replacing callable with \Closure in these signatures matches the actual runtime behavior and removes the false positive, with no change in supported usage (only Closures were ever accepted as the callback form).

The where(), orWhere(), join() family, and Model::where() accepted
`callable` in a union with `string`, even though the implementation
only ever checks `instanceof \Closure`. Static analyzers (Intelephense
and similar) treat a `callable` parameter as a potential function-name
reference, so passing a plain column name like 'page_id' triggered a
false "Call to unknown function" diagnostic in the IDE.

Replacing `callable` with `\Closure` in these signatures matches the
actual runtime behavior and removes the false positive, with no change
in supported usage (only Closures were ever accepted as the callback
form).
@benkhalife benkhalife merged commit c354d9b into main Jun 17, 2026
11 checks passed
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.

1 participant