packagist psalm/plugin-laravel v4.19.4

latest release: v4.19.5
one hour ago

This patch release lets Psalter fix OctaneIncompatibleBinding. It also fixes facade method sealing, Stringable on Carbon and collections, env() closure defaults, and plugin warnings that were hidden under --no-progress.

Features

  • Let Psalter fix OctaneIncompatibleBinding: vendor/bin/psalter --issues=OctaneIncompatibleBinding rewrites singleton() to scoped() and singletonIf() to scopedIf() (#2261)
-$this->app->singleton(Cart::class, fn ($app) => new Cart($app->make(Request::class)));
+$this->app->scoped(Cart::class, fn ($app) => new Cart($app->make(Request::class)));

Fixes

  • Report unknown calls on stubbed facades (App, DB, Event, Route, Schema) again; a misspelled call silently returned mixed (#2270)
 Schema::hasTabel('users');
-// no issue, returns mixed
+// UndefinedMagicMethod
  • Keep Stringable on Carbon, CarbonPeriod, Collection and LazyCollection, whose stubs had dropped it (#2268)
 /** @return array<string, scalar|\Stringable|null> */
 function reportRow(?Carbon $lastReferralDate): array {
     return ['last_referral_date' => $lastReferralDate];
-    // ImplicitToStringCast
+    // no issue
 }
  • Resolve a closure default of env() to the closure's return type, as value() does at runtime; a void closure now gives string|null (#2272, #2273)
 env('KEY', fn (): int => 1);
-// string|Closure(): 1
+// resolves to the closure's return type, not the closure
  • Keep a plain receiver's own type in when()/unless() instead of X&static, so returning it from a : static method reports MoreSpecificReturnType (#2271)
  • Print plugin warnings (plugin disabled, degraded boot, skipped checks) to STDERR under --no-progress, and stop aborting the run when the deprecated PSALM_LARAVEL_PLUGIN_CACHE_PATH env var is set (#2274)

Full Changelog: v4.19.3...v4.19.4

Don't miss a new plugin-laravel release

NewReleases is sending notifications on new releases.