packagist psalm/plugin-laravel v3.13.0
v3.13.0 - Named Scopes

3 hours ago

A comprehensive overhaul of Eloquent query-scope analysis: instance scope calls on the base Builder, self/static scope parameters, direct-vs-forwarded dispatch, and variadic / name-collision handling.

Features

  • Resolve instance scope calls on the base Builder to Builder<Model> instead of mixed, type-checking arguments against the scope's declared params (#1032)
  • Resolve self/static scope parameters to the model on custom builders, removing false InvalidArgument and Model&static over-narrowing (#1033)
  • Classify scope calls by PHP dispatch semantics rather than argument shape, so nullable ?Builder, variadic, and non-variable first arguments resolve correctly (#1041)
  • Harden the scope-params hand-off (consume-once) and fix return types when a scope name collides with a real Eloquent\Builder method such as find() (#1042)

Fixes

  • Fix direct scope calls that pass $query explicitly to keep the real method signature, with no left-shifted arguments (#1035)
  • Fix direct scope calls passing $query to use the real return type instead of a fabricated Builder<Model> (#1036)
  • Fix trait-hosted scope self parameters to resolve to the composing class, so a sibling subclass is accepted instead of rejected with a false InvalidArgument (#1043)

Behavior change

  • For a trait composed on an abstract parent, the InvalidArgument message for a bad scope argument now names the composing parent (e.g. AbstractDocument) instead of the queried child (e.g. Contract) (#1031, #1043). No migration needed; the diagnostic is simply more accurate.

Full Changelog: v3.12.3...v3.13.0

Don't miss a new plugin-laravel release

NewReleases is sending notifications on new releases.