packagist psalm/plugin-laravel v4.20.0

one hour ago

This release requires Psalm 7.5. It adapts the plugin to Psalm 7.4 and 7.5, and fixes several false positives in Eloquent, Collection and migration analysis.

Requirements

  • Require vimeo/psalm ^7.5.0 (was ^7.3.1) and psalm/psalm-plugin-api ^0.4.3 (#2300)

Fixes

  • Stop analyzing Blade templates as plain PHP on Psalm 7.4+. A raw <?php block no longer reports every issue twice, and @psalm-suppress inside it stays local again (#2305)
 <?php strlen([4]); ?>
-// InvalidArgument (reported twice for the same template line)
+// InvalidArgument (reported once)
  • Stop reporting CliOnlyCall in migration files and routes/console.php (#2300)
 return new class () extends Migration {
-// CliOnlyCall
     public function up(): void {}
 };
  • Support models with @mixin \Eloquent (written by laravel-ide-helper ide-helper:models --write) or another own @mixin: builder calls resolve again (#2301)
 /** @mixin \Eloquent */
 final class Post extends Model {}

 Post::where('id', 1);
-// UndefinedMagicMethod: Magic method Post::where does not exist
+// Builder<Post>
  • Fix false ArgumentTypeCoercion on Eloquent Builder::tap() with a callback typed to the concrete model or an invokable scope object (#2290)
  • Resolve #[UseEloquentBuilder] inherited from a parent class or a used trait, so queries get the custom builder (#2287)
  • Keep T for $class::query() (class-string<T>) and $model->newQuery() (T) on models with a custom builder, instead of CustomBuilder<Model&static>; a valid @return Builder<T> no longer reports InvalidReturnStatement (#2285)
  • Keep TValue in Collection::first() and Collection::get() results when the default is a Closure (#2283)
 /** @var Collection<int, User> $users */
 $users->first(null, fn () => 1);
-// 1
+// 1|User
  • Honor Schema::morphUsingUuids() and morphUsingUlids() for morphs() and nullableMorphs() columns: the *_id column is string instead of int (#2284)
  • Drop every column of a variadic dropColumn('a', 'b') and stop treating dropVectorIndex() as a column in the migration schema (#2288)
  • Stop reporting constructors of events that use Illuminate\Foundation\Events\Dispatchable as unused (#2277)
  • Suppress MissingConstructor on Livewire and Volt components, whose properties are set in mount() or restored from the snapshot (#2276)

Full Changelog: v4.19.5...v4.20.0

Don't miss a new plugin-laravel release

NewReleases is sending notifications on new releases.