Commit e66ca4c
committed
Fix PHPStan errors: new static() in trait and Eloquent method access on interface
- Add @phpstan-consistent-constructor to SubscribableMailMessage so that
new static() inside the SubscribableNotification trait is recognised as
safe. Without this annotation PHPStan cannot verify that subclasses share
the same constructor signature.
- Add is_a($modelClass, Model::class, true) to the UnsubscribeController
guard so PHPStan narrows $modelClass to class-string<Model> in addition
to class-string<CanUnsubscribe>. Larastan knows Model declares where() and
getRouteKeyName(), eliminating the two 'method.notFound' errors. The check
is also correct at runtime: subscribers must be Eloquent models.
https://claude.ai/code/session_01R4pAjWwGY8xKspsdU8xnsy1 parent e9f25f8 commit e66ca4c
2 files changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
0 commit comments