diff --git a/src/Generator.php b/src/Generator.php index 804bad3..41ddfda 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -190,13 +190,9 @@ protected function getFormRules(): array $parameters = $action_instance->getParameters(); foreach ($parameters as $parameter) { - $class = $parameter->getClass(); - - if (!$class) { - continue; - } - - $class_name = $class->getName(); + $class_name = $name = $parameter->getType() && !$parameter->getType()->isBuiltin() + ? new \ReflectionClass($parameter->getType()->getName()) + : null; if (is_subclass_of($class_name, FormRequest::class)) { return (new $class_name)->rules();