Parameter #1 $callback of method
Illuminate\Database\Eloquent\Collection<int,Illuminate\Database\Eloquent\Model>::map()
expects callable(Illuminate\Database\Eloquent\Model, int): array{id:
string|null, text: string},
Closure(App\Models\SerialNumber): array{id: string|null,
text: non-falsy-string} given.
somehow phpstan das not recognize that SerialNumber is a child class from the Model
If you please can share any of your ideas in stackoverflow
https://stackoverflow.com/questions/76729231/larastan-complains-about-collection-methods-paramaters-after-upgrading-to-larave
Steps To Reproduce
install phpstan and run the checks on your project
Hey there, thanks for reporting this issue.
If you notice improper DocBlock, PHPStan, or IDE warnings while using Laravel, do not create a GitHub issue. Instead, please submit a pull request to fix the problem. Also see our contribution guide.
Thanks!
If only I'd know how to fix it.
It seems to be a deep conflict of architectures between Laravel and PhpStan.
I made an issue report to them phpstan/phpstan#9735
But PhpStan made their descision:
it's dangerous to require ModelA because the callback might be called with a different child of Model
What they call "dangerous", I call - "validation".