Skip to content

v4.15.0

Latest

Choose a tag to compare

@github-actions github-actions released this 16 Jul 12:58
v4.15.0
a6121bb

What's Changed

v4.15.0 ships the 2nd biggest architectural change in the plugin's history: ModelMetadataRegistry, a single per-model metadata store that replaces the ad-hoc reflection and private caches every Eloquent handler used to maintain on its own. This release builds three new model-correctness diagnostics on top of it, validating attributes and relationships on your models, plus a more precise serialization inference — and it's the foundation a lot more diagnostics are planned to build on next.

Upgrade impact

  • new UnknownModelAttribute and UndefinedModelRelation report at info by default. Opt into error with <experimental value="true" />.
  • new UnresolvableAppendedModelAttribute reports at error by default: a $appends entry with no matching accessor or cast now fails analysis. Downgrade it with a standard issueHandlers entry if that doesn't fit your codebase yet.
  • attributesToArray() / toArray() now infer a precise array shape. Always active, no config needed.

Features

  • ⭐️ Add ModelMetadataRegistry, a per-model metadata store warmed once during AfterCodebasePopulated and shared read-only across every Eloquent handler (#1081, #1201)
  • ⭐️ Add the experimental psalm.xml config flag to promote experimental features for early adopters (#1248)
  • Add UnknownModelAttribute: flags a create()/fill()/update() key with no backing column, cast, accessor, $appends entry, or @property (#1167)
 Model::create(['nmae' => 'value']);
-// silently drops the typo, sets nothing
+// UnknownModelAttribute: 'nmae' matches no column, cast, accessor, $appends entry, or @property
  • Add UnresolvableAppendedModelAttribute: flags a $appends entry with no accessor or cast to actually produce it (#1169)
  • Add UndefinedModelRelation: validates relation names passed to with()/load()/has()/whereHas() against the resolved model (#1181)
 Customer::with('vehicles.typoOnVehicle');
-// no warning, silently ignored at runtime
+// UndefinedModelRelation: Relation 'typoOnVehicle' is not defined on App\Models\Vehicle
  • Infer a precise array shape for attributesToArray()/toArray(), honoring casts, hidden, and appended attributes (#1168, #1184)

Fixes

  • Fix whereDate two-argument overload (#1247)

Internal changes

  • Reset stateful handlers between plugin invocations (#1250)
  • Allow psalm-delta on fork PRs with a restore-only cache guard (#1269)

Full Changelog: v4.14.12...v4.15.0