NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #617 most downloaded on Packagist
Psalm plugin for Laravel
Latest stable
v4.19.1
Last release 10 days ago
10 Nov 2026
Ships fairly regularly
a new release about every 9 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
201 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
This is the biggest release since v4.0.
This is the biggest release since v4.0.
Is release is focused on Validator and FormRequest classes and provides best-in-class type infer for them.
FormRequest (#577) @alies-devView\Factory and View\View methods (#580) @alies-devJs::from() and Js::encode() (#573) @alies-devSession\Store::get() and other) (#557) @alies-devMail and Notification classes (#556) @alies-devRequest::integer() and Request::float() (#575) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.3.2...v4.4.0
Add PHP 8.2 support (#554) @alies-dev
| Dependency | plugin v3 | plugin v4 |
|---|---|---|
| PHP | ^8.2 | ^8.2 |
| Laravel | 11, 12 | 12, 13 |
| Psalm | 6, 7 (beta) | 7 only |
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.3.1...v4.3.2
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Accept flexible callable signatures in Attribute::make()
Attribute::make() (#552)@psalm-taint-escape html for e() helper to avoid false negatives (#551)stubs/taintAnalysis/ into stubs/common/ (#553)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.3.0...v4.3.1
This release focuses on migration schema analysis for better Eloquent attribute type inference.
This release focuses on migration schema analysis for better Eloquent attribute type inference.
Schema call patterns (connection chaining, class constants, custom facades) (#526)foreignIdFor() column type from referenced model's primary key (#523)Blueprint::datetimes() and fix ulid() default column name (#531)mixed type for unknown Blueprint methods (custom DB types added by macros) (#528)Collection::map() return type, add Builder::select() and ResponseTrait::cookie() stubs (#548)@psalm-taint-escape sql for Connection::escape() (#547)UploadedFile and encrypt/decrypt helpers (#546)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.2.0...v4.3.0
Relationship accessors without generics — The plugin now resolves Eloquent relationship property types even when methods lack generic annotations. Pre
Relationship accessors without generics — The plugin now resolves Eloquent relationship property types even when methods lack generic annotations. Previously, $user->posts required @return HasMany<Post, User> to get a precise type. Now the plugin parses the method body AST to extract the related model from $this->hasMany(Post::class), falling back gracefully to bounded types.
Static Query Builder methods on Models — User::where(...), User::orderBy(...), and model scopes now resolve with the correct Builder<User> return type, enabling full type inference through query chains starting from the model class.
SQL schema dump support — The plugin now parses php artisan schema:dump output (MySQL, PostgreSQL, SQLite) as a base layer for model attribute discovery. PHP migrations are applied on top, matching Laravel's own resolution order.
🛡️ Security: new taint sinks — Added XSS detection through HtmlString (which bypasses Blade escaping) and path traversal detection through Storage facade methods (put, writeStream, delete, copy, move, etc.).
Query\Builder methods and scopes on Model classes (#508)Schema\ColumnDefinition, ForeignIdColumnDefinition, and ForeignKeyDefinition fluent methods (#501)HtmlString to detect XSS bypass of Blade escaping (#491)Storage facade / FilesystemAdapter path traversal detection (#492)up() (#509)nullableTimestampsTz() switch case in schema aggregatorcount/update/increment/decrement return type to int<0, max> (#499)hasUserPseudoProperty() helper to reduce redundant storage lookups$codebase->progress->debug() to relationship resolution catch blocks for --debug traceabilityfindStubFiles() — errors now propagate to the top-level handlerFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.1.0...v4.2.0
feat: infer pluck() value type from model @property annotations (#488) @alies-dev
pluck() value type from model @property annotations (#488) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.0.1...v4.1.0
Taint Analysis: add sinks for sub-query builder methods (#481) @alies-dev
Collection::filter() return type when called without callback (#467) @alies-devroute helper function stub as not needed anymore @alies-devonce helper function stub as not needed anymore @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.0.0...v4.0.1
psalm-plugin-laravel is the only free tool that combines Laravel-aware type analysis with dataflow-based taint vulnerability detection:
The biggest release since the plugin was created. 90% of the codebase was rewritten for stability, performance, and deeper Laravel coverage.
./vendor/bin/psalmAttribute<TGet, TSet> templates all work. Use both tools together: Larastan for types, psalm-plugin-laravel for securitybarryvdh/laravel-ide-helper dependency -- facades and model properties are now resolved natively by the pluginInvalidConsoleArgumentName,
InvalidConsoleOptionName,
NoEnvOutsideConfig@property declarations take precedence over migration-discovered propertiescasts() parsing without method executionscopeXxx() methods and Laravel 12+ #[Scope] attribute, plus the Scope interfaceafter() closures, Blueprint::rename(), addColumn(), vector columns, and auto-discovery of directories registered via loadMigrationsFrom()| Dependency | v3 | v4 |
|---|---|---|
| PHP | ^8.2 | ^8.3 |
| Laravel | 11, 12 | 12, 13 |
| Psalm | 6, 7 (beta) | 7 only |
Eloquent relation generics now require a declaring model parameter (e.g., BelongsTo<Foo> becomes BelongsTo<Foo, self>).
composer require --dev psalm/plugin-laravel:^4.0 -W
psalm-plugin-laravel is the only free tool that combines Laravel-aware type analysis with dataflow-based taint vulnerability detection:
| Vulnerability | Laravel surface | OWASP |
|---|---|---|
| SQL Injection | DB::statement(), DB::unprepared(), query builder raw methods |
A03:2021 |
| Shell Injection | Process::run(), Process::pipe() |
A03:2021 |
| File Traversal | Storage::get(), Storage::put(), 15 Filesystem methods |
A01:2021 |
| SSRF | Http::get(), Http::post(), 6 HTTP client methods |
A10:2021 |
| XSS | Response::setContent(), ResponseFactory::make() |
A03:2021 |
| Open Redirect | Redirect::to(), Redirect::away() |
A10:2021 |
| Crypto tracking | Encrypter, HashManager taint-escape/unescape |
A02:2021 |
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.1.5...v4.0.0
See v4.0.0 Beta 1 release for full list of major changes
See v4.0.0 Beta 1 release for full list of major changes
composer require --dev psalm/plugin-laravel:^4.0@beta -W
If you have "minimum-stability": "stable", and got Your requirements could not be resolved to an installable set of packages.: error
composer config minimum-stability beta
composer config prefer-stable true
composer require --dev vimeo/psalm:^7.0@beta psalm/plugin-laravel:^4.0@RC -W
See Upgrading from v3 to v4 for details.
RC Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.0.0-rc.1...v4.0.0-rc.2
Major Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.1.5...v4.0.0-rc.2
See v4.0.0 Beta 1 release for full list of major changes
See v4.0.0 Beta 1 release for full list of major changes
composer require --dev psalm/plugin-laravel:^4.0@beta -W
If you have "minimum-stability": "stable", and got Your requirements could not be resolved to an installable set of packages.: error
composer config minimum-stability beta
composer config prefer-stable true
composer require --dev vimeo/psalm:^7.0@beta psalm/plugin-laravel:^4.0@RC -W
See Upgrading from v3 to v4 for details.
NoEnvOutsideConfig rule to detect env() calls outside config directory https://github.com/psalm/psalm-plugin-laravel/pull/456CastsMethodParser AST traversal — getAttribute('parent') is always null https://github.com/psalm/psalm-plugin-laravel/pull/458createMany param types and CastsMethodParser AST parent lookup https://github.com/psalm/psalm-plugin-laravel/pull/462RC/Beta Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.0.0-beta.2...v4.0.0-rc.1
Major Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.1.5...v4.0.0-rc.1
feat: infer precise types for Console command argument() and option() calls (#457) @alies-dev
Beta Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v4.0.0-beta.1...v4.0.0-beta.2
Major Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.1.5...v4.0.0-beta.2
Support Laravel 12–13; drop Laravel 11 (and update other dependencies)
@property declarations (take precedence over migration-discovered properties)scopeXxx() and #[Scope] attribute)barryvdh/laravel-ide-helper dependency — facades and model properties are now resolved nativelycomposer require --dev psalm/plugin-laravel:^4.0@beta -W
Major Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.1.5...v4.0.0-beta.1
…the plugin when a vendor file raised a load-time deprecation
Two opt-in rules that catch typos in route names and filesystem disks, plus sharper inference for Eloquent relations, aggregate attributes, when()/unless() callbacks, and Collection::filter().
UnregisteredRouteName rule for route names missing from the booted app's route table: route(), to_route(), URL::route()/signedRoute()/temporarySignedRoute(), Redirect::route(), redirect()->route(), url()->route(). Enable with <findUnregisteredRouteNames value="true" /> or <experimental value="true" /> (#1573) return redirect()->route('users.shwo', $user);
+// UnregisteredRouteName: Route name 'users.shwo' is not registered
UnconfiguredFilesystemDisk rule for Storage::disk() names absent from filesystems.disks, with a closest-name suggestion. Enable with <findUnconfiguredFilesystemDisks value="true" /> or <experimental value="true" />. \Storage::disk() now also narrows to FilesystemAdapter like the facade (#1571) Storage::disk('publik')->put($path, $contents);
+// UnconfiguredFilesystemDisk: Disk 'publik' is not configured in filesystems.disks, did you mean 'public'?
when()/unless() callback parameters from the condition value: when() passes the truthy value, unless() the falsy one, and a Closure condition passes its return type (#1645) /** @var ?int $limit */
$query->when($limit, function (Builder $q, string $limit) { /* ... */ });
-// no issue: the callback parameter was never checked
+// InvalidArgument: when expects callable(Builder<...>, int):mixed|null, but Closure(Builder, string):void provided
return $this->allRevisions()->where(...)) (#1646) // HasPaymentSlips trait: public function paymentSlips(): MorphMany { return $this->morphMany(PaymentSlip::class, 'owner'); }
$member->paymentSlips();
-// MorphMany<Model, Model>
+// MorphMany<PaymentSlip, Member>
Collection::filter(callable) like where(callable), and recognize is_subclass_of(), is_a(), is_scalar(), is_iterable(), is_resource() and null checks (!is_null($x), $x !== null) in both (#1651) $items->filter(fn (Countable $x): bool => $x instanceof Stringable);
-// Collection<int, Countable>
+// Collection<int, Countable&Stringable>
$classes->filter(fn (string $c): bool => is_subclass_of($c, Job::class));
-// Collection<int, string>
+// Collection<int, class-string<Job>>
{relation}_count / {relation}_exists as nullable unless withCount()/withExists()/loadCount()/loadExists() is proven on that model (or the relation is in $withCount), and type withMin/withMax/withSum/withAvg attributes from the related column's type (#1628) $post->comments_count ?? $post->loadCount('comments')->comments_count;
-// RedundantCondition: comments_count was always int
+// no issue: int|null until a count is proven loaded
Model as @psalm-consistent-constructor, so new $class() on a class-string<Model> is no longer UnsafeInstantiation. A model overriding __construct with an incompatible signature is now reported, since Eloquent's own new static($attributes) already breaks on it (#1626) /** @param class-string<Model> $class */
function make(string $class): Model { return new $class(); }
-// UnsafeInstantiation
+// no issue
Collection in BelongsToMany::sync(), syncWithoutDetaching(), syncWithPivotValues() and their Laravel 13 *OrFail() variants (#1644) $user->roles()->sync($roles->pluck('id'));
-// InvalidArgument / ImplicitToStringCast
+// no issue
$this as the declaring model for relation calls inside non-final models, so return $this->rel()->where(...) no longer reports MoreSpecificReturnType / LessSpecificReturnStatement (#1629, #1632)SoftDeletes methods per receiver model on a generic custom builder shared by a parent and child model, instead of whichever model was scanned last (#1638)@psalm-mutation-free from Request::input(), which lazily decodes JSON: a FormRequest overriding input() is no longer flagged (#1627)$request->input(...), Artisan::command(...), Job::dispatch(...)) with zend.assertions=1 (#1659)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.6...v3.17.0
v3.16.6 restores vendor methods on stubbed Laravel classes that silently resolved to mixed, and tightens docblock types for console, events, facades,
v3.16.6 restores vendor methods on stubbed Laravel classes that silently resolved to mixed, and tightens docblock types for console, events, facades, mail, and relations.
mixed when nothing in the project named that class before the plugin's stubs loaded. Psalm then skipped the class's vendor file, so with __call (Macroable) every method the stub did not declare became mixed with no issue reported. Affected classes included Events\Dispatcher, Http\Client\PendingRequest, Http\Client\Response, FormRequest, Pipeline, and several facades (#1616, #1618) app('events')->hasListeners('order.shipped');
-// mixed
+// bool
Artisan::all() and Console\Kernel::all() (contract and concrete) as array<array-key, Command> instead of array (#1612) $commands = Artisan::all();
-// array<array-key, mixed>
+// array<array-key, Symfony\Component\Console\Command\Command>
DB::getQueryLog() entries and Schema::getColumnListing() with the shapes Connection and Schema\Builder already document, instead of the facades' plain array (#1612) $log = DB::getQueryLog();
-// array<array-key, mixed>
+// list<array{query: string, bindings: array<array-key, mixed>, time: float|null, readWriteType?: string|null}>
until(), dispatch() with $halt = true) on Events\Dispatcher, its contract, and the Event facade as mixed: it returns the first non-null listener response, not array|null (#1612)MailMessage properties ($view nullable; $from, $replyTo, $attachments, $rawAttachments with the shapes MailChannel accepts), MailMessage::render() as HtmlString|string, and Notification::$id as string|null (#1612)Collection of related models in BelongsToMany::saveMany() and saveManyQuietly(), and keep its type on return (#1612)Reflector::getParameterClassNames() as list<string>, Route::methods() as array<string>, accept null in Migrator::usingConnection(), and mark UrlGenerator's resolver, formatter, and forced root/scheme properties nullable (#1612)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.4...v3.16.6
A patch release adding a header-injection sink for response headers.
A patch release adding a header-injection sink for response headers.
TaintedHeader under --taint-analysis: the $headers argument of ResponseFactory::make() (direct, contract, and facade forms), the three-argument response() helper, and new Response() is now a header sink. The attachment exemption still applies only to the TaintedHtml content finding (#1575) $title = $request->input('team');
return response()->make($csv, 200, [
'Content-Disposition' => "attachment; filename=\"{$title}.csv\"",
]);
-// before: no issue
+// now: TaintedHeader: Detected tainted header
alies-dev/psalm-plugin-pest instead of psalm/plugin-phpunit in psalm-laravel init when the project requires pestphp/pest (#1596)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.3...v3.16.4
A patch release fixing pipe object rejection in Pipeline.
A patch release fixing pipe object rejection in Pipeline.
Pipeline::through() and Pipeline::pipe(), matching Laravel's own Pipeline::carry(), which calls the pipe's method on any object (#1590) by @yuriy-sorokin $pipeline->through(new AuthenticateMiddleware());
-// InvalidArgument: Argument 1 of Pipeline::through expects array<Closure|callable|string>|Closure|callable|string, but AuthenticateMiddleware provided
+// accepted, returns Pipeline&static
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.2...v3.16.3
A patch release with fixes for translation, view, facade and laravel/ai type inference.
A patch release with fixes for translation, view, facade and laravel/ai type inference.
Closure values in the $replace argument of __(), matching how Laravel's translator calls them with the matched text (#1444) __('some.key', ['name' => fn (string $matched): string => strtoupper($matched)]);
-// InvalidArgument: Argument 2 of __ expects array<string, null|scalar>, but array{name: pure-Closure(...)} provided
+// accepted, returns string
MissingView for $this->view() in test cases using InteractsWithViews (opt-in via findMissingViews) (#1445) final class WelcomeTest extends \Illuminate\Foundation\Testing\TestCase
{
public function test_it_renders(): void
{
$this->view('does.not.exist')->assertSee('hello');
- // no issue
+ // MissingView: View 'does.not.exist' not found in any of the registered view paths
}
}
App::environment() to bool when called with environment names, and to string with no arguments (#1453) $isLive = App::environment(['production', 'staging']);
-// string|bool
+// bool
Laravel\Ai\Tools\Request::validate() as a taint source like the class's other data accessors: validation constrains shape, not content, so the returned values are still attacker-controlled (#1446)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.1...v3.16.2
v3.16.1 refines the v3.16.0 laravel/ai and MissingView work: exempts annotated prompt guards from TaintedLlmPrompt, extends MissingView to mailables,
v3.16.1 refines the v3.16.0 laravel/ai and MissingView work: exempts annotated prompt guards from TaintedLlmPrompt, extends MissingView to mailables, and fixes a Redis facade regression.
laravel/ai middleware guards annotated with @psalm-taint-escape llm_prompt from TaintedLlmPrompt, so a blocking prompt-injection guard (e.g. promptphp/intercept) silences the finding at its dispatched handle()/__invoke() method (#1441)final class PromptInjectionGuard
{
/** @psalm-taint-escape llm_prompt */
public function handle(AgentRequest $request, Closure $next) { /* ... */ }
}
// agent's middleware() resolves to [PromptInjectionGuard::class]
// TaintedLlmPrompt no longer fires on prompts passing through it
Mailables\Content constructors and extend MissingView to Mailable::view()/markdown()/text() and view Factory::composer()/creator() (#1431, #1432) new Content(view: 'emials.welcome');
-// before: no issue
+// now: MissingView: View 'emials.welcome' not found in any of the registered view paths
Redis::pipeline()/transaction() callback results as list<mixed> instead of reporting UndefinedMagicMethod (#1427) Redis::pipeline(fn ($pipe) => $pipe->get('key'));
-// before: UndefinedMagicMethod: Magic method Illuminate\Support\Facades\Redis::pipeline does not exist
+// now: list<mixed>
handle(), and controller-action return values as framework-consumed, fixing spurious PossiblyUnusedReturnValue under --find-unused-code (#1434)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.16.0...v3.16.1
v3.16.0 adds taint-analysis support for the `laravel/ai` package: prompt-injection detection plus tracking of LLM output into SQL, shell, and HTML sin
v3.16.0 adds taint-analysis support for the laravel/ai package: prompt-injection detection plus tracking of LLM output into SQL, shell, and HTML sinks. It also extends MissingView to every view-name-bearing API and ships several new type-narrowing features.
The plugin now understands laravel/ai (>=0.11.0 <1.0.0, #937). The integration loads only when Composer reports the package installed; apps without it get no extra stubs or handlers. Prompt-input findings are enabled automatically; <findPromptInjection value="false" /> turns them off while keeping model-output findings.
Untrusted data (request input, HTTP responses, tool arguments, retrieved documents) reaching an LLM prompt is reported:
final class SupportAgent
{
use \Laravel\Ai\Promptable;
}
(new SupportAgent())->prompt($request->input('question'));
// 🔴 TaintedCustom: Detected tainted llm_prompt
LLM output is treated as a taint source, so it is followed into the existing SQL, shell, file, and HTML sinks:
function run(\Laravel\Ai\Responses\AgentResponse $response): void {
DB::select($response->text);
}
// 🔴 TaintedSql: raw model output interpolated into a query
MissingView beyond view() and Factory::make() to Factory::first()/renderWhen()/renderEach(), response()->view(), Route::view(), MailMessage::view()/markdown(), and assertViewIs() (#1407) Route::view('/welcome', 'welcom');
// 🔴 MissingView: View 'welcom' not found in any of the registered view paths
Arr::get() value type from known array shapes, including dot-notation keys and $default handling (#1402) /** @param array{a: int} $data */
$value = Arr::get($data, 'a');
-// before: mixed
+// now: int
Manager::driver() to its create*Driver() return type, including the no-argument default-driver form (#1410) final class ShippingManager extends Manager
{
public function getDefaultDriver(): string { return 'ups'; }
public function createUpsDriver(): Shipper { return new UpsShipper(); }
}
$manager->driver('ups'); // Shipper
-$manager->driver(); // was: mixed
+$manager->driver(); // now: Shipper
getCollection() to a model's custom Eloquent collection (#1408) #[CollectedBy(WorkOrderCollection::class)]
class WorkOrder extends Model {}
WorkOrder::query()->paginate()->getCollection();
-// before: Eloquent\Collection<int, WorkOrder>
+// now: WorkOrderCollection<int, WorkOrder>
TaintedHtml for response()->make() bodies explicitly served as attachments (#1348) response()->make($csv, 200, ['Content-Disposition' => 'attachment; filename="export.csv"']);
-// before: TaintedHtml
+// now: no issue — the response is a download, not rendered HTML
new Illuminate\Http\Response(...), and safe literal Content-Type values; HTML, XML, SVG, and script types stay reported (#1417)PersonalAccessToken binding for models using HasApiTokens without an explicit @use annotation, fixing spurious MissingTemplateParam (#1425)HasFactory bindings from newFactory(), static $factory, and #[UseFactory] without suppressing unrelated MissingTemplateParam diagnostics on the model (#1423)handle() methods, Eloquent relations) so --find-unused-code stops flagging them as dead (#1422)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.7...v3.16.0
Taint accuracy for named arguments, plus three Eloquent and Collection narrowings.
Taint accuracy for named arguments, plus three Eloquent and Collection narrowings.
// sinkNamed(string $path = 'safe', string $label = 'x'), file sink on $path
sinkNamed(label: (string) $request->input('page'));
-// TaintedFile (before): the taint landed on $path, which never saw the request
+// no issue: the argument is attributed to $label
AbstractPaginator::getCollection() and AbstractCursorPaginator::getCollection() to Eloquent\Collection when the paginator holds models (#1397). The 33 methods that exist only on the Eloquent collection (load*, find, fresh, modelKeys, toQuery, ...) are now reachable. $users = User::paginate();
$users->getCollection()->load('posts');
-// UndefinedMethod (before): Support\Collection<int, User> has no load()
+// now resolves: Eloquent\Collection<int, User>
select() stubs for Collection, LazyCollection, and Eloquent\Collection (#1399), including the select(null) branch and the variadic form. $rows = collect([['a' => 1, 'b' => 2]])->select('a');
-// Collection<array-key, mixed>&static (before); select('a', 'b') reported TooManyArguments
+// Collection<array-key, array<array-key, mixed>>
Auth::guard() and Auth::shouldUse() when the guard name is a string-backed enum case (#1405). Previously any non-literal argument dropped all narrowing back to the bare contract. Auth::guard(Guards::Admin)->user();
-// Illuminate\Contracts\Auth\Guard (before)
+// now resolves through SessionGuard to the configured user model
<experimental value="true" /> now also enables findSerializedQueuedModels, unless the project sets that flag explicitly (#1400). experimental is the early-access switch for rules that are off by default and on their way to becoming default.Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.6...v3.15.7
Two new inference sources for Eloquent-backed code, one new opt-in queue-safety rule, and three false-positive fixes across migrations, model attribut
Two new inference sources for Eloquent-backed code, one new opt-in queue-safety rule, and three false-positive fixes across migrations, model attribute helpers, and pipelines.
SerializedQueuedModel rule for ShouldQueue classes that hold an Eloquent model without reaching Illuminate\Queue\SerializesModels, where the whole model is written into the queue payload instead of a ModelIdentifier (#1385). Enable with <findSerializedQueuedModels value="true" />. Detection resolves the flattened __serialize() / __sleep() rather than matching the trait name, so framework bases that already pull the trait in (Illuminate\Foundation\Queue\Queueable, Illuminate\Notifications\Notification) and classes that hand-write their own serialization stay silent. final class ReconcileLedger implements ShouldQueue
{
public function __construct(private Customer $customer) {}
- // silent: the entire Customer row is written into the queue payload
+ // SerializedQueuedModel: $customer will be serialized whole into the queue payload
}
Arr::pluck() value and key types from the element model's @property annotations, matching what Collection::pluck() and Builder::pluck() already do (#1383). /** @param list<Customer> $rows */ // Customer has @property string $id
-Arr::pluck($rows, 'id'); // array<array-key, mixed>
+Arr::pluck($rows, 'id'); // list<string>
-Arr::pluck($rows, 'id', 'id'); // array<array-key, mixed>
+Arr::pluck($rows, 'id', 'id'); // array<string, string>
$schema = Schema::connection(...) in migrations, so columns declared through a variable-held builder (#1382).Model::getAppends() and Model::getMutatedAttributes() to list<string>, so callers no longer have to re-assert the element type (#1381).Pipeline::then() from its destination closure instead of leaving it mixed (#1376).Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.5...v3.15.6
Taint precision and Eloquent type narrowing. Two taint fixes remove a duplicate finding and close a missed SQL injection, and four type fixes sharpen
Taint precision and Eloquent type narrowing. Two taint fixes remove a duplicate finding and close a missed SQL injection, and four type fixes sharpen inference on facades, collections, and the query builder.
@method tags, so templated facade methods resolve their real return type (#1370) $value = Cache::remember('key', 60, fn (): User => User::first());
-// mixed — the generated @method tag outranked the plugin's stub
+// User
groupBy() and keyBy() keys for model columns instead of widening to array-key (#1369) $byId = User::all()->keyBy('id');
-// Collection<array-key, User>
+// Collection<int, User>
chunkById() callback like chunk(), so the chunk is a templated collection rather than mixed (#1373) Article::query()->chunkById(100, function ($chunk) { ... });
-// $chunk: mixed
+// $chunk: Collection<int, Article>
$fetchUsing argument on DB::select(), DB::selectResultSets(), DB::cursor(), and their Connection counterparts, while keeping the three-argument signature an error on Laravel 12 (#1374) DB::cursor('select * from users', [], true, [PDO::FETCH_ASSOC]);
-// TooManyArguments — the stub declared three parameters
+// accepted on Laravel 13; still TooManyArguments on Laravel 12
Row types follow the fetch mode, so a custom $fetchUsing no longer claims stdClass:
$rows = DB::cursor('select 1'); // Generator<int, stdClass>
$assoc = DB::cursor('select 1', [], true, [PDO::FETCH_ASSOC]);
-// Generator<int, stdClass>
+// Generator<int, mixed>
TaintedInclude only, not also TaintedFile (#1358). A view name selects which template executes; it cannot reach an arbitrary path, because the view finder rewrites . to / and appends a fixed extensionWhereColumnTaintHandler's removal bridge on the AST node itself rather than spl_object_id, closing a missed SQL injection (#1366). Psalm frees foreign ASTs mid-file, so a reissued object handle could hit a stale record and strip sql taint from an unrelated expressionFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.4...v3.15.5
Extends taint reporting to the call forms Laravel applications actually write — facade statics, response() on its contract, and view() names — and cle
Extends taint reporting to the call forms Laravel applications actually write — facade statics, response() on its contract, and view() names — and clears the false positives that surfaced alongside it.
response() contract methods, and view() names (#1318). A facade's surface is @method pseudo-methods resolved through __callStatic, whose parameters have no docblock to carry a sink, so the static form was silent while the chained form fired. Redirect::to($request->input('next'));
-// silent: the facade pseudo-parameter carried no sink
+// TaintedHeader: Detected tainted header
$with and $withCount (#1321). Supports dotted paths, column selectors, and the $withCount alias grammar; defers when an intermediate related model cannot be resolved. class Post extends Model
{
protected $with = ['auther'];
- // silent: eager-load defaults were never validated
+ // UndefinedModelRelation: relation 'auther' is not defined on Post
}
@psalm-taint-escape on closure validation rules (#1352), in inline validate() arrays, in FormRequest rules(), and when the closure is the field's whole rule. Previously the only way to assert a rule made a value safe was to extract it into a dedicated Rule class. $request->validate([
'path' => ['required', /** @psalm-taint-escape file */ static fn ($attr, $value, $fail) => /* ... */],
]);
-// TaintedFile: a closure body is opaque, so no rule could assert safety
+// clean
TaintedSql false positives on where() array values for nullable, template-bounded, and intersection builder receivers (#1338, #1350). Values in the map form are PDO-bound, but a receiver typed Builder|null, @template T of Builder, or T&Builder declined the strip. /** @param Builder|null $query */
$query->where(['status' => $request->input('status')]);
-// TaintedSql: Detected tainted SQL
+// clean
TaintedFile on uploaded-file extensions (#1324, #1325). getClientOriginalExtension() is the tail after the final dot of a normalized basename and cannot introduce a path segment, and clientExtension() returns a value from Symfony's MIME registry rather than raw client input. All other taint kinds, including include, are unchanged. Storage::putFileAs('uploads', $file, Str::ulid() . '.' . $file->getClientOriginalExtension());
-// TaintedFile: Detected tainted file handling
+// clean
Suppress cross-class taint flow through the Dispatchable traits (#1334). Psalm conflated taint nodes from the shared trait bodies, so an argument dispatched to one job appeared to reach an unrelated job's constructor sink. Genuine Bus and Event taint is still reported.
Fingerprint the migration schema cache on file contents instead of modification times (#1346). A git clone stamps every file with the checkout time, so the fingerprint changed on every CI run and the cache never hit even when the restored schema was still valid.
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.3...v3.15.4
Taint-analysis precision for static where()/whereNot() calls and redirect responses (Psalm 6 line), ported from the paired v4.15.3 release.
Taint-analysis precision for static where()/whereNot() calls and redirect responses (Psalm 6 line), ported from the paired v4.15.3 release.
TaintedSql false positives and a false negative on where()/whereNot() static receivers and nested-condition array values (#1300). class ConcreteOverrideModel extends Model {
/** @psalm-taint-sink sql $column */
public static function where(mixed $column): void {}
}
$term = (string) $request->input('term');
-ConcreteOverrideModel::where([['name', '=', $term]]); // silent (false negative, own sink stripped)
+ConcreteOverrideModel::where([['name', '=', $term]]); // TaintedSql
Article::where([['name', '=', $request->keyword]]);
-// TaintedSql (false positive) -- mixed value failed the outer position's scalar gate
+// clean -- inner nested-condition value strips unconditionally on a real Model receiver
TaintedSSRF false positive on redirect() and Redirect/ResponseFactory redirect responses. A redirect is a header/open-redirect sink, not a server-side request, so it now reports the correct sink kind (#1313).-return redirect($request->input('next')); // TaintedSSRF (wrong sink kind)
+return redirect($request->input('next')); // TaintedHeader
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.2...v3.15.3
Taint-analysis precision for the query where() family (Psalm 6 line). Resolves the TaintedSql inconsistency from #1300 (the same safe query reported o
Taint-analysis precision for the query where() family (Psalm 6 line). Resolves the TaintedSql inconsistency from #1300 (the same safe query reported or stayed silent depending on how it was written), and closes two SQL source/sink gaps.
Request::__get() as user input, so $request->term carries taint like $request->input('term') (#1305). DB::table('t')->whereRaw((string) $request->input('term')); // TaintedSql
-DB::table('t')->whereRaw((string) $request->term); // silent
+DB::table('t')->whereRaw((string) $request->term); // TaintedSql
whereColumn() / orWhereColumn() on all three identifier positions, which the grammar emits raw (#1308).-$builder->whereColumn((string) $request->input('c'), '=', 'other'); // silent
+$builder->whereColumn((string) $request->input('c'), '=', 'other'); // TaintedSql
where() sql-taint strip on a Laravel builder receiver, so a non-builder where(array $parts) that interpolates raw SQL keeps its report (#1311).where() array forms raising a false TaintedSql on PDO-bound value positions; the strip now walks the array literal element-wise and keeps the sink only on raw-identifier positions (#1302, fixes #1300). $term = (string) $request->input('term');
-Model::where([['name', 'LIKE', "%{$term}%"]]); // TaintedSql (false positive)
+Model::where([['name', 'LIKE', "%{$term}%"]]); // clean — value is PDO-bound
whereLike-family $value param to mixed, matching where() and the PDO-bound runtime, so idiomatic calls stop reporting false positives (#1312).-Model::whereLike('name', $request->query('q')); // PossiblyInvalidArgument
+Model::whereLike('name', $request->query('q')); // clean
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.1...v3.15.2
This release improves Eloquent pluck() and builder type narrowing, plus primary-key and factory binding inference.
This release improves Eloquent pluck() and builder type narrowing, plus primary-key and factory binding inference.
pluck()->all() to list<TValue> (#1299) Task::all()->pluck('id')->all();
-// array<int, int> -- rejected by a list<int> return type
+// list<int> -- pluck() always reindexes sequentially
pluck() and aggregate narrowing on custom subclasses, raw aliases, and schema-typed columns (#1288) /** @extends Builder<Task> */
class TaskBuilder extends Builder {}
$tasks->pluck('title');
-// Collection<array-key, mixed> -- LHS fallback only checked generic builders
+// Collection<int, string> -- resolved via @extends Builder<Task>
Factory<TModel> on bare factory subclasses (#1280) class TaskFactory extends Factory {}
(new TaskFactory())->create();
-// Model -- TModel collapses to base Model with no @extends Factory<Task> binding
+// Task -- model resolved via Factory::modelName() at warm-up
Model::getKey() to the model's known primary-key type (#1279) class UuidModel extends Model { use HasUuids; }
$model->getKey();
-// int|string -- always the stub's fallback
+// string -- narrowed from the model's known primary-key type
// Order has a custom builder with `firstByMake(): ?self`
$vehicle->orders()->firstByMake('Toyota');
-// mixed -- custom builder-only methods weren't resolved through the relation
+// ?Order -- forwarded through the relation via Psalm storage
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.15.0...v3.15.1
v3.15.0 ships the biggest architectural change in the plugin's history: ModelMetadataRegistry, a single per-model metadata store that replaces the ad-
v3.15.0 ships the 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.
UnknownModelAttribute and UndefinedModelRelation report at info by default. Opt into error with <experimental value="true" />.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.ModelMetadataRegistry, a per-model metadata store warmed once during AfterCodebasePopulated and shared read-only across every Eloquent handler (#1081, #1201)experimental config flag to promote experimental diagnostics to error (#1248)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
UnresolvableAppendedModelAttribute: flags a $appends entry with no accessor or cast to actually produce it (#1169)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
attributesToArray()/toArray(), honoring casts, hidden, and appended attributes (#1168, #1184)UnknownModelAttribute (#1265)RelationResolver from autoloading related models, fixing an analysis crash (#1272)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.1592...v3.15.0
3.14159265... close enough. Here's your π release, the last one, before a big v3.15
3.14159265... close enough. Here's your π release, the last one, before a big v3.15
Eloquent\Builder::whereDate() rejecting DateTimeInterface values (Carbon, DateTimeImmutable) in the two-argument form (#1247) Post::query()->whereDate('created_at', CarbonImmutable::now());
-// ImplicitToStringCast (before): Argument 2 expects string but Carbon provided
+// now resolves: whereDate() accepts DateTimeInterface in two-arg form
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.12...v3.14.1592
Narrow several producer and validation return types to their concrete implementations, plus fixes for Cache::driver()->flexible() and monorepo init sc
Narrow several producer and validation return types to their concrete implementations, plus fixes for Cache::driver()->flexible() and monorepo init scanning.
Password::broker(), view()/trans(), and query builder pagination results to their concrete Laravel implementation (#1240) Password::broker()->createToken($user);
-// UndefinedInterfaceMethod (before): createToken() only exists on the concrete broker
+// now resolves: typed as Auth\Passwords\PasswordBroker
view('welcome')->fragment('x');
-// UndefinedInterfaceMethod (before): fragment() only exists on Illuminate\View\View
+// now resolves: typed as View\View
integer()/boolean() accessors and rule-bound integer fields from validation rules (#1239, #1237)UndefinedInterfaceMethod false positive on Cache::driver()->flexible() (#1233)<projectFiles> in psalm-laravel init on Composer monorepos (#1235)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.11...v3.14.12
Collection type inference for arbitrary inputs, and partial Laravel boots now surface instead of failing silently, plus three false-positive fixes aro
Collection type inference for arbitrary inputs, and partial Laravel boots now surface instead of failing silently, plus three false-positive fixes around query builders and monorepo init already shipped on the 4.x line.
This release bumps min supported Laravel minor versions:
collect(), Collection::make(), and LazyCollection::make() return types for arbitrary inputs, not just arrays (#1225) collect('hello');
-// InvalidArgument (before): string wasn't Arrayable|iterable|null
+// now infers: Collection<0, 'hello'>
collect(BackedSuit::Hearts);
-// InvalidArgument (before): enum cases weren't accepted either
+// now infers: Collection<0, BackedSuit>
collect(null);
-// before: Collection<array-key, mixed> (unbound fallback)
+// now infers: Collection<never, never>
UndefinedMagicMethod on custom Eloquent builder subclass methods called after a fluent chain (#1219)UndefinedMagicMethod on IndexDefinition modifiers in database migrations (#1220)psalm-laravel init on monorepos: no longer puts packages/ into <ignoreFiles>, which silently disabled analysis of package sources (#1214)bootstrap() failures: a partial Laravel boot now emits a warning by default, and fails the run under failOnInternalError (#1226)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.10...v3.14.11
A patch release that focused on removing some false positives.
A patch release that focused on removing some false positives.
TaintedSql on where() calls that pass a column-to-value map (where(['name' => $value])) (#1221)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.9...v3.14.10
This release improves custom Eloquent builder inference and narrows several stub return types.
This release improves custom Eloquent builder inference and narrows several stub return types.
newQuery(), newQueryWithoutScopes(), etc. (#1207)getCasts() and getTouchedRelations() return types (#1205)Request::route()/Request::file() default value handling (#1205)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.8...v3.14.9
Patch release fixing Psalm execution on Windows.
Patch release fixing Psalm execution on Windows.
proc_open(): CreateProcess failed warning on Windows by executing psalm through the current PHP binary instead of relying on the shebang (#1189) @HenkPoleyFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.7...v3.14.8
Fixes caching issue, that makes Psalm complaining about CastsAttributes.
Fixes caching issue, that makes Psalm complaining about CastsAttributes.
CastsAttributes: restore user_defined on cast contracts on warm cache (#1188)Arr/Lottery stub shells being removed, which caused UndefinedClass in projects that don't reflect illuminate/support (e.g. laravel/socialite)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.6...v3.14.7
Narrow sum/avg/min/max return types on relations and collections instead of widening to mixed
sum/avg/min/max return types on relations and collections instead of widening to mixed (#1183)UndefinedMethod on forwarded Query\Builder methods in custom builder subclasses (#1145)migrator resolution when the app bootstraps partially, avoiding a crash during analysis (#1175)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.5...v3.14.6
This patch sharpens conditional return types for several Laravel helpers and guards against two crash paths during partial app bootstrap.
This patch sharpens conditional return types for several Laravel helpers and guards against two crash paths during partial app bootstrap.
Pagination::fragment(), Arr::random(), and Lottery::choose() (#1176)Route::domain() so it narrows $this vs string (#1174)Paginator::through() to the updated template after the callback (#1173)migrator resolution so analysis no longer crashes when the app bootstraps partially (#1175)psalm-laravel analyze through to psalm CLI (#1158)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.4...v3.14.5
This patch sharpens type inference across collections, the console, and the Date facade, and improves Laravel 11 support by handling Carbon 2.
This patch sharpens type inference across collections, the console, and the Date facade, and improves Laravel 11 support by handling Carbon 2.
Command::hasArgument()/hasOption() to literal bool, and fix hasOption() shortcut/negation semantics (#1161)Date facade static calls (#1157)literal() helper (#1160)config()->collection() to Collection<key, value> (#1159)random() return type on Enumerable and LazyCollection (#1152)null option shortcut in Command::getOptions() (#1166)Model::loadCount() constraint closure as Builder (#1164)null values in the __() $replace parameter (#1151)SessionGuard::hashPasswordForCookie() on Laravel 11 (#1146)psalm-plugin init from silently disabling type analysis on Psalm 6 (#1144)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.2...v3.14.4
Patch release: fewer false positives on Laravel's Application contract and uploaded files, plus a simpler (but more powerful and secure) generated CI
Patch release: fewer false positives on Laravel's Application contract and uploaded files, plus a simpler (but more powerful and secure) generated CI workflow added via psalm-laravel add ci.
Application methods (isProduction(), isLocal(), path(), ...) when the receiver is typed on the Contracts\Foundation\Application interface, eliminating false UndefinedInterfaceMethod on app(), ServiceProvider::$app, and Command::$laravel (#1141)TaintedFile / TaintedSSRF on UploadedFile reads: its only string coercion is the server-controlled temp path, while the user-controlled accessors (contents, client name, MIME type) stay tainted (#1136)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.1...v3.14.2
Patch release for the 3.x (Psalm 6) line. Fixes the init command emitting Psalm 7-only configuration, plus Laravel 11 analysis correctness plus other
Patch release for the 3.x (Psalm 6) line. Fixes the init command emitting Psalm 7-only configuration, plus Laravel 11 analysis correctness plus other enhancements and fixes from 4.x branch:
$this in Artisan::command() closures so command callbacks resolve $this to the command instance (#1122)Artisan::command() $this override to the callback closure so it no longer leaks to surrounding scope (#1127)UndefinedMethod on app('encrypter') method calls (#1128)UndefinedMethod on guard methods reached via auth() narrowing (#1121)tap() form as HigherOrderTapProxy<T> (#1112)orderBy() direction ('ASC'/'DESC') on Laravel <13.8 (#1111)Query\Builder::orderBy() direction as asc/desc literals plus SortDirection (#1104)Expression as the $sql argument to Query\Builder::whereRaw() (#1106)Filesystem::hash() return as non-empty-string|false (#1109)find() (#1105)firstOrNew/updateOrCreate closure values on Laravel 13.5+ (#1102)Connection::cursor() rows as stdClass instead of mixed (#1100)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.14.0...v3.14.1
v3.14.0 spans Eloquent type inference and security: three new security detectors, relationship and filesystem narrowing, paginator fixes, and an opt-i
v3.14.0 spans Eloquent type inference and security: three new security detectors, relationship and filesystem narrowing, paginator fixes, and an opt-in query-builder best-practice rule.
html_url taint kind for URL-context XSS distinct from e() (#1014)ImplicitQueryBuilderCall rule for direct model query and scope calls. It requires writing User::query()->where(...) instead of User::where(...) (#1068)MissingTemplateParam on in-body belongsToMany()/morphToMany() pivot chains (#1090)mixed collapse when chaining off relation methods, by replacing $this with static in generic templates and using @template-covariant for relationships (#1055)Storage::disk() to FilesystemAdapter so temporaryUrl() and url() resolve (#1093)FilesystemAdapter listing methods to list<string> (#1094)FormRequest magic property reads ($request->field calls) (#1022)app(Foo::class) as Foo when the booted app cannot resolve it (Laravel packages) (#1076)UndefinedMethod on $app->when()->needs() chains (#1077)when()/unless() callback return types (#997)paginate() and preserve the related-model template through relations (#1082)PossiblyUnusedMethod on Eloquent trait boot/initialize hooks (#1080)/psalm-delta workflow to benchmark plugin over real apps and libs (#1079, #1086, #1084) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.13.2...v3.14.0
Add PublicModelScope and PublicModelAccessor rules for public model scopes and accessors (#1056) @alies-dev
PublicModelScope and PublicModelAccessor rules for public model scopes and accessors (#1056) @alies-devScopes and Eloquent:
Builder<Model> from $class::query() (#1073) @alies-dev->orWhere->scope()) (#1066) @alies-devOther:
App::make() facade calls to the resolved class (#1072) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.13.1...v3.13.2
<!-- Release notes generated using configuration in .github/release.yml at 3.x -->
<!-- Release notes generated using configuration in .github/release.yml at 3.x -->
InvalidArgument on addGlobalScope closures with bare Builder params by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/1045#[Scope] detection and scope-vs-QueryBuilder params precedence by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/1046Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.13.0...v3.13.1
A comprehensive overhaul of Eloquent query-scope analysis: instance scope calls on the base Builder, self/static scope parameters, direct-vs-forwarded
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.
Builder to Builder<Model> instead of mixed, type-checking arguments against the scope's declared params (#1032)self/static scope parameters to the model on custom builders, removing false InvalidArgument and Model&static over-narrowing (#1033)?Builder, variadic, and non-variable first arguments resolve correctly (#1041)Eloquent\Builder method such as find() (#1042)$query explicitly to keep the real method signature, with no left-shifted arguments (#1035)$query to use the real return type instead of a fabricated Builder<Model> (#1036)self parameters to resolve to the composing class, so a sibling subclass is accepted instead of rejected with a false InvalidArgument (#1043)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: https://github.com/psalm/psalm-plugin-laravel/compare/v3.12.3...v3.13.0
Backported features from v4.12.1 and v4.12.2
Backported features from v4.12.1 and v4.12.2
$this->input() return type inside FormRequest (#1017) @alies-devCastsAttributes / Castable casts to real types (#1020) @alies-devCollection::where() return types (#1019) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.12.0...v3.12.3
Nothing published for this version
Narrow config() and Repository::get() return types (#1006) @alies-dev
config() and Repository::get() return types (#1006) @alies-devJs::from() and Js::encode() taint per call-site (reduce false-positive reports) (#1010) @alies-devRequest::query() and Request::post() return types (#1009) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.11.0...v3.12.0
Resolve dynamic where{Column} on Model direct calls (#1001) @alies-dev
where{Column} on Model direct calls (#1001) @alies-devBuilder aggregate (avg(), max(), sum(), etc) returns using a known column type (#1005) @alies-devwhere{Column} arguments on Eloquent relations (#939) @alies-devwhere{Column} method calls (#980) @alies-devpluck($value, $key) key type and cover relation chains (#968) @alies-devModel::only() return shape from literal keys (#933) @alies-devSET columns to literal union in ModelPropertyHandler (#932) @alies-devMacroable return type info from docblock Psalm storage (#989) @alies-dev: static return types (#987) @alies-devdiagnose subcommand for runtime introspection (#959) @alies-devdiagnose command and enhance config created by the init command (#971) @alies-devpsalm-laravel init command @alies-devModel::factory()->create() collapse on bare HasFactory (#964) @alies-devauth($name) return to concrete guard class (#981) @alies-devStorage::disk() return to Cloud for cloud-driver disks (#982) @alies-devRoute::middleware facade and RouteRegistrar (#986) @alies-devRequest::file() via source-level conditional return (#935) @alies-devPossiblyUnusedMethod):
PossiblyUnusedMethod for legacy scopeXxx() Eloquent methods (#999) @alies-devPossiblyUnusedMethod for #[Scope]-attributed Eloquent methods (#998) @alies-devconfig_path() at the project root under Testbench fallback (#949) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.10.2...v3.11.0
<!-- Release notes generated using configuration in .github/release.yml at master -->
<!-- Release notes generated using configuration in .github/release.yml at master -->
list<T> from Collection::values()->all() chain by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/921Rules\Enum and Rules\In object forms in validated() by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/911PropertyNotSetInConstructor on Laravel testing lifecycle properties by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/916Factory::hasAttached rejects Eloquent\Collection from count()->create() by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/915Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.10.1...v3.10.2
<!-- Release notes generated using configuration in .github/release.yml at 3.x -->
<!-- Release notes generated using configuration in .github/release.yml at 3.x -->
Factory count/times chains by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/878Model::query() flattening static for plain models by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/890.stubphp to .phpstub by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/891Arg helper to dedupe per-call-arg type/node access in handlers by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/892Builder template-arg invariants by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/893@throws annotations on synthesised macro pseudo-methods by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/900 (currently blocked by Psalm)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.9.2...v3.10.0
<!-- Release notes generated using configuration in .github/release.yml at master -->
<!-- Release notes generated using configuration in .github/release.yml at master -->
BelongsToMany/MorphToMany by @alies-dev in #883Rule::in(...) fluent builder to literal-string union by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/877Route::middleware() chain inference on Psalm dev-master by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/889psalm-laravel init command by @alies-dev in #881:
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.9.2...v3.9.3
⭐️ Support Laravel 13 by plugin v3 by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/871
using/as chain mutations on belongsToMany / morphToMany by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/868NoEnvOutsideConfig by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/859PossiblyUnusedMethod:
PossiblyUnusedMethod reports for FormRequest hooks by @andrew-demb in https://github.com/psalm/psalm-plugin-laravel/pull/863PossiblyUnusedMethod suppression to common Laravel hook methods: Command, Migration, Seeder, Mailable, Notification, ServiceProvider by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/866Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.9.1...v3.9.2
Fix Psalm crash on AuthManager::__call-forwarded methods (eg auth()->authenticate()) (#856) @alies-dev
AuthManager::__call-forwarded methods (eg auth()->authenticate()) (#856) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.9.0...v3.9.1
This release is focused respecting validation rules when to mark input as safe.
This release is focused respecting validation rules when to mark input as safe.
FormRequest input() / string() / str() accessors (#821) @alies-dev@psalm-taint-escape on custom Rule classes (#826) @alies-devscopes() chaining on builder contracts (#846) @alies-devfirstOr() callback template across argument positions (#851) @alies-devvendor/bin/psalm-laravel CLI with init subcommand for first-time plugin setup (#786) @alies-devpsalm-laravel add subcommand to scaffold a GitHub Actions security-analysis workflow (#814) @alies-devCollection, Session, RedirectResponse, LazyCollection, MessageBag, ServiceProvider(#809, #832) @alies-devCollection::make / LazyCollection::make / collect() for scalar inputs (#783) @alies-devInvalidArgument on arrow-function closures in the Builder::where family (#784) @alies-devonly / except / collect / old to the correct traits (#825) @alies-devimplements / extends in 4 stubs that were wiping reflected metadata (#835, #836) @alies-devStatsHandler to report plugin-level counts under psalm --stats (#817) @alies-devBackport changes from v4.8.2- v4.8.4 releases
Backport changes from v4.8.2- v4.8.4 releases
AuthManager instance calls, not just the Auth facade (#773) @alies-devStringable-accepting stubs to reduce ImplicitToStringCast false positives (#775) @alies-devfilled() to narrow ?string to non-empty-string (#762) @alies-devapp(static::class, ...) and class-string<Foo> arguments (#754) @alies-devModel subclasses (e.g. Laravel Scout) (#769) @alies-devNoEnvOutsideConfig from firing inside analysed project's config/ (#767) @alies-devDocblockTypeContradiction on filled()/blank() guards with nullable strings (#753) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.8.1...v3.8.4
Prevent plugin crashing on invalid Facade aliases by @alies-dev in https://github.com/psalm/psalm-plugin-laravel/pull/746
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.8.0...v3.8.1
v3.8.0 is a full backport of 4.x features to the Laravel 11–12 + Psalm 6 support line. Everything that shipped in v4.x–4.8 is now available on 3.x.
v3.8.0 is a full backport of 4.x features to the Laravel 11–12 + Psalm 6 support line. Everything that shipped in v4.x–4.8 is now available on 3.x.
From this release, almost all new features will be released on both 3.x and 4.x branches.
This release adds psalm-security-analysis AI skill installable via Laravel Boost. You can install it by re-running boost:update (or boost:install on fresh installations).
This allows your agent find and fix security issues found by Psalm taint analysis.
<img width="1126" height="848" alt="image" src="https://github.com/user-attachments/assets/97caf072-c970-4601-9cf7-9427717d3b10" />
BelongsToMany and MorphToMany stubs now declare 4 template params — migrate BelongsToMany<T, U> → BelongsToMany<T, U, Pivot, 'pivot'> (#716)
If you documented such relationships directly in your codebase, the migration process is straightforward:./vendor/bin/psalter --plugin=vendor/psalm/plugin-laravel/tools/psalter/UpgradeRelationAnnotations.php
env('KEY', $default) return type based on the default argument — env('KEY', 'val') → string, env('KEY', false) → string|false (#712)Auth::guard('web') to its concrete class (SessionGuard, TokenGuard) from auth.php config (#711)Collection::whereNotNull() to remove null from TValue when called without a key (#713)withCount/withExists/withSum/withMin/withMax/withAvg aggregate accessor properties on Eloquent models without UndefinedMagicPropertyFetch (#715)dispatch() and dispatchIf() arguments against the job/event constructor signature (#726)Carbon (or a custom date class from Date::use()) for now() and today() helpers (#725)SoftDeletes methods (withTrashed, onlyTrashed, withoutTrashed) on base Builder instances (#727)HigherOrderCollectionProxy method call chains precisely — $users->sortByDesc->method() no longer produces InvalidMethodCall (#724)Config::array() and Config::collection() $default argument — scalar fallbacks emit InvalidArgument (#736)<dynamicWhereMethods value="true" /> config to resolve where{Column} calls on relation chains (#714)Http\Client\Response body/header methods (body(), json(), header(), etc.) as taint sources (#676)@psalm-taint-sink file to ~30 path-accepting methods in Filesystem, FilesystemAdapter, and LockableFile (#739)collect() with no arguments to return Collection<never, never> instead of Collection<array-key, mixed> (#722)Collection::empty() to return static<never, never>, assignable to any typed collection (#679)Collection::sum() from mixed to int|float (#680)Conditionable::when()/unless() and Tappable::tap() returning mixed on fluent chains — now returns $this (#710)$col->map, $col->each) to carry concrete TKey/TValue types (#720)Str::replace() return to string when the subject is a string (#719)@psalm-this-out to paginator setCollection() to narrow the type after item replacement (#688)$user->posts()->published()->get() now resolves correctly (#738)TaintedHtml from Blade view $data parameters — Blade auto-escapes {{ $var }} output (#690)TaintedSql from PDO-parameterized Builder methods (where, find, having, etc.) (#691)PossiblyUnusedMethod false positives for legacy Eloquent getXxxAttribute()/setXxxAttribute() methods (#732)Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.4.0...v3.8.0
Backports type inference and taint analysis improvements from Plugin 4.x to Psalm 6 users.
Backports type inference and taint analysis improvements from Plugin 4.x to Psalm 6 users.
CookieJar make/queue/forever/forget methods flagged as taint-sink headerStorage::put(), Storage::prepend(), Storage::append() as path/file sinksHttp::get(), Http::post(), Http::send() as SSRF sinkssession() helper and Store methods as taint sources (XSS, SQL injection)View::make(), view() helper, View::share() as HTML sinksMailable subject/to/from as header sinks, body/line/action as HTML sinkseval, evalSha, executeRaw as eval sinksfilename, path, contents, MIME type as taint sourcesencrypt()/decrypt() correctly modeled as taint escape/unescapeheader(), withHeaders(), cookie() as header sinksStubs backported from v4.0–v4.6 to reduce false positives:
count → int<0,max>, get → Collection<int, stdClass>, cursor → LazyCollection), added 20+ method stubs (whereNot, having, from, orderBy, etc.)cursor, pluck, paginators, firstOrCreate; added whereNot, createOrFirst, findSole, chunkMap; @psalm-variadic on with()/without()Stringable/HasBroadcastChannel implements, public increment/decrementBlueprint, ColumnDefinition, ForeignIdColumnDefinition, ForeignKeyDefinition (fluent migration chains)Authenticatable, SessionGuard, TokenGuardfilter() without callback now removes null/false from TValue; flatten(1)/collapse() preserve TValueFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.3.0...v3.4.0
feat: update Collection, Model, Builder stubs (backport them from 4.x) @alies-dev
Collection, Model, Builder stubs (backport them from 4.x) @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.2.2...v3.3.0
Enhance DX by accelerating tests @alies-dev
Full Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.2.1...v3.2.2
Better type infer for MorphTo relationships @alies-dev
MorphTo relationships @alies-devFull Changelog: https://github.com/psalm/psalm-plugin-laravel/compare/v3.2.0...v3.2.1
One column per quarter.