diff --git a/src/Handlers/SuppressHandler.php b/src/Handlers/SuppressHandler.php new file mode 100644 index 0000000..9a9cc23 --- /dev/null +++ b/src/Handlers/SuppressHandler.php @@ -0,0 +1,27 @@ +getStorage(); + + // Commands: suppress PropertyNotSetInConstructor. + if (in_array(Command::class, $storage->parent_classes) && !in_array('PropertyNotSetInConstructor', $storage->suppressed_issues)) { + $storage->suppressed_issues[] = 'PropertyNotSetInConstructor'; + } + + // FormRequest: suppress PropertyNotSetInConstructor. + if (in_array(FormRequest::class, $storage->parent_classes) && !in_array('PropertyNotSetInConstructor', $storage->suppressed_issues)) { + $storage->suppressed_issues[] = 'PropertyNotSetInConstructor'; + } + } +} diff --git a/src/Plugin.php b/src/Plugin.php index 93f46fd..19ab633 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -12,6 +12,7 @@ use Psalm\LaravelPlugin\Handlers\Helpers\RedirectHandler; use Psalm\LaravelPlugin\Handlers\Helpers\TransHandler; use Psalm\LaravelPlugin\Handlers\Helpers\UrlHandler; use Psalm\LaravelPlugin\Handlers\Helpers\ViewHandler; +use Psalm\LaravelPlugin\Handlers\SuppressHandler; use Psalm\LaravelPlugin\Providers\ApplicationProvider; use Psalm\LaravelPlugin\Providers\FacadeStubProvider; use Psalm\LaravelPlugin\Providers\ModelStubProvider; @@ -75,6 +76,8 @@ class Plugin implements PluginEntryPointInterface $registration->registerHooksFromClass(TransHandler::class); require_once 'Handlers/Helpers/RedirectHandler.php'; $registration->registerHooksFromClass(RedirectHandler::class); + require_once 'Handlers/SuppressHandler.php'; + $registration->registerHooksFromClass(SuppressHandler::class); } private function generateStubFiles(): void