Skip to content

Commit

Permalink
Fix PHP8 deprecation in Generator::getFormRules
Browse files Browse the repository at this point in the history
See mtrajano#60 for more details
  • Loading branch information
viki53 authored Mar 9, 2021
1 parent e63d7a5 commit d932524
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit d932524

Please sign in to comment.