amir5's avatar
Level 7

phpstan undefined method after using ide-helper:generate

I've added a macro to RedirectResponse class:

        RedirectResponse::macro('withUpdatedSuccessfully', function () {
            return $this->with([
                'success-message' => __('Updated successfully'),
            ]);
        });

phpstan:

Method Illuminate\Http\RedirectResponse::withUpdatedSuccessfully() invoked with 0 parameters, 1 required.

then I decided to add laravel-ide-helper package to generate them(php artisan ide-helper:generate), and I've added scanFiles: - _ide_helper.phpto phpstan.neon, but now, it shows more errors:

...

  Call to an undefined static method Illuminate\Http\RedirectResponse::macro().
         🪪  staticMethod.notFound
....
   Call to an undefined method Illuminate\Routing\Route::name().
         🪪  method.notFound
...
0 likes
0 replies

Please or to participate in this conversation.