PHPackages                             interaction-design-foundation/psalm-laravel-nova - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. interaction-design-foundation/psalm-laravel-nova

ActivePsalm-plugin[Testing &amp; Quality](/categories/testing)

interaction-design-foundation/psalm-laravel-nova
================================================

Psalm plugin for Laravel Nova

v0.1.1(1mo ago)11.6k↑1960%[2 issues](https://github.com/InteractionDesignFoundation/psalm-laravel-nova/issues)2MITPHPPHP ^8.4CI passing

Since Jul 10Pushed 1w agoCompare

[ Source](https://github.com/InteractionDesignFoundation/psalm-laravel-nova)[ Packagist](https://packagist.org/packages/interaction-design-foundation/psalm-laravel-nova)[ RSS](/packages/interaction-design-foundation-psalm-laravel-nova/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (6)Versions (4)Used By (2)

Psalm plugin for Laravel Nova
=============================

[](#psalm-plugin-for-laravel-nova)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8b6df82af0c6a1b52af23406691d467f019984748ed6290d9ddcc5442fa024e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e746572616374696f6e2d64657369676e2d666f756e646174696f6e2f7073616c6d2d6c61726176656c2d6e6f76612e737667)](https://packagist.org/packages/interaction-design-foundation/psalm-laravel-nova)[![Total Downloads](https://camo.githubusercontent.com/7060779b11ddbc6fad779baf73ffa8b34b94108ae6e8a9794630b07d86a201ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e746572616374696f6e2d64657369676e2d666f756e646174696f6e2f7073616c6d2d6c61726176656c2d6e6f76612e737667)](https://packagist.org/packages/interaction-design-foundation/psalm-laravel-nova)[![License](https://camo.githubusercontent.com/22ad2f4034e719adc322e5674b645daf275e67548b7428800ffbaa5faa90246d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e746572616374696f6e2d64657369676e2d666f756e646174696f6e2f7073616c6d2d6c61726176656c2d6e6f76612e737667)](LICENSE)

A [Psalm](https://psalm.dev) plugin that resolves [Laravel Nova](https://nova.laravel.com)'s magic: the reflective dispatch and `@method` annotations that static analysis cannot follow on its own. Works with Laravel apps and Nova packages.

> This plugin covers Nova only. Install it **in addition to** [`psalm/plugin-laravel`](https://github.com/psalm/psalm-plugin-laravel), which covers the Laravel framework itself. It is not a replacement.

Nova dispatches resources, actions, filters, lenses, cards, tools, dashboards and metrics through reflection and naming conventions that live entirely inside `laravel/nova`. Psalm cannot see those call sites, and several Nova base classes carry `@method` annotations whose signatures do not describe what their subclasses actually accept. The result is a stream of false positives on an otherwise clean Nova codebase.

This plugin removes them. Its guiding principle is **silence over false positives**: when a type cannot be resolved with confidence, the plugin declines and lets Psalm fall back to its own inference rather than guessing.

Installation
------------

[](#installation)

```
composer require --dev interaction-design-foundation/psalm-laravel-nova
```

Then enable it:

```
vendor/bin/psalm-plugin enable interaction-design-foundation/psalm-laravel-nova
```

Keep [`psalm/plugin-laravel`](https://github.com/psalm/psalm-plugin-laravel) installed and enabled alongside it: this plugin handles Nova-specific conventions and relies on the Laravel plugin for everything else (Eloquent models, facades, container bindings).

What it does
------------

[](#what-it-does)

### `make()` calls are checked against the right constructor

[](#make-calls-are-checked-against-the-right-constructor)

`Laravel\Nova\Element` declares `@method static static make(string|null $component = null)` and `Laravel\Nova\Panel` declares its own differently-shaped `@method make(...)`. Psalm stores `@method` annotations as pseudo methods and, during static-call resolution, gives an ancestor's pseudo method priority over the class's own real (variadic) `make()`. Because almost no concrete Nova field or panel declares its own `@method make(...)` override, every `Text::make('Label', 'column')` resolves against `Element`'s single-optional-parameter signature and reports `TooManyArguments`.

`NovaMakeSignatureHandler` gives each class a `make()` signature derived from its own constructor.

### Resource query methods are narrowed to the resource's model

[](#resource-query-methods-are-narrowed-to-the-resources-model)

Nova's `Resource::indexQuery()`, `relatableQuery()` and friends receive a `Builder` that Psalm sees as `Builder`. `NovaResourceQueryMethodHandler` narrows it to the resource's concrete model, resolved in two steps:

1. the `@extends \Laravel\Nova\Resource` template binding, including when inherited transitively through intermediate base classes;
2. the `public static $model = SomeModel::class` convention property, read from the AST when no template binding resolves.

The property value is validated (it must exist and be a genuine `Model` subclass) before narrowing, so a typo never produces a confidently wrong type.

### `$this->when(...)` no longer poisons `fields()`

[](#this-when-no-longer-poisons-fields)

`Illuminate\Http\Resources\ConditionallyLoadsAttributes::when()` returns `mixed`, which degrades the inferred element type of every array literal built with it, including Nova's `fields()` and `actions()`. `NovaWhenReturnTypeHandler` introspects the argument and returns the closure's return type (or the value's type) unioned with `MissingValue`. A literal `true`/`false` condition drops the dead branch. When the type cannot be resolved, the provider declines rather than leaking a raw `Closure` into the union.

### Reflectively dispatched members are not reported as unused

[](#reflectively-dispatched-members-are-not-reported-as-unused)

Under `findUnusedCode="true"`, members Nova reaches by reflection have no visible call site. `NovaSuppressHandler` covers the ones that stubs cannot express, mirroring what `Psalm\LaravelPlugin\Handlers\SuppressHandler` does for Laravel:

- `PossiblyUnusedMethod` on an action's `handle()`, which Nova dispatches through `method_exists()` and the container rather than a base-class declaration;
- `PossiblyUnusedMethod` on a resource's open-ended `relatable{FieldName}()` query methods;
- `PossiblyUnusedMethod` on the Gate methods (`viewAny`, `view`, `create`, …) of the policy a resource names in `public static $policy`, which Nova reaches via `authorizedTo()` → `Gate::callPolicyMethod()`;
- `NonInvariantPropertyType` on `$policy` itself, but only for declarations compatible with the stub's `string` — `public static int $policy` still raises.

Hook methods that override a base declaration (`fields()`, `apply()`, `calculate()`, …) already inherit the parent's "used" status from the stubs, so they need no suppression.

### Nova stubs

[](#nova-stubs)

The plugin ships stubs for `Action`, `Field`, `Element`, `PartitionResult`, `Panel` and `Resource` that fix vendor signatures Psalm cannot resolve. `Resource` is templated, so a resource can declare its model with `@extends`:

```
/** @extends \Laravel\Nova\Resource */
final class User extends Resource
{
    public static $model = \App\Models\User::class;
}
```

The stubs are registered by the plugin itself; no `` entry is needed in `psalm.xml`.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Psalm 7.0+

`laravel/nova` is not a dependency: the plugin relies on its own stubs and resolves everything else from the analysed codebase.

Contributing
------------

[](#contributing)

Pull requests are welcome. Run the checks before opening one:

```
composer cs:fix     # auto-fix both
composer psalm
```

License
-------

[](#license)

[MIT](LICENSE). Copyright © The Interaction Design Foundation.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance75

Regular maintenance activity

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9acedf8ce33bd0f1b27bc0de9ea640544c778c1752263254e9591b2f2661dec?d=identicon)[alies-dev](/maintainers/alies-dev)

![](https://avatars.githubusercontent.com/u/90964642?v=4)[IxDF](/maintainers/IxDF)[@ixdf](https://github.com/ixdf)

---

Top Contributors

[![alies-dev](https://avatars.githubusercontent.com/u/5278175?v=4)](https://github.com/alies-dev "alies-dev (20 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (2 commits)")

---

Tags

phpphp-static-analysispsalm-pluginpsalmsstatic-anaysislaravelstatic analysisnovapsalmpsalm-plugin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/interaction-design-foundation-psalm-laravel-nova/health.svg)

```
[![Health](https://phpackages.com/badges/interaction-design-foundation-psalm-laravel-nova/health.svg)](https://phpackages.com/packages/interaction-design-foundation-psalm-laravel-nova)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[guanguans/laravel-soar

SQL optimizer and rewriter for laravel. - laravel 的 SQL 优化器和重写器。

2228.6k](/packages/guanguans-laravel-soar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
