I am using Laravel 10 + PHPStan.
When I use Resource with the Laravel code, then PHPStan sends me this error:
18 Access to an undefined property App\Http\Resources\LocationResource::$id.
19 Access to an undefined property App\Http\Resources\LocationResource::$name.
20 Access to an undefined property App\Http\Resources\LocationResource::$comment.
21 Access to an undefined property App\Http\Resources\LocationResource::$library_id.
22 Access to an undefined property App\Http\Resources\LocationResource::$created_at.
I know I can solve this issue with some annotations. But I do not want to use that. I prefer use the phpstan.neon file and declare inside which error phpstan must ignore. See the documentation here.
So my phpstan.neon file looks like that:
parameters:
paths:
- app/
ignoreErrors:
- '#Call to an undefined method [a-zA-Z0-9\\_::]#'
- '#Access to an undefined property App\\Http\\Resources\\[a-zA-Z0-9]::#'
It is the second 'ignoreErrors' line which is not correct.
Which regex I must enter in this conf file to ignore these kinds of errors?