Open viki53 opened 3 years ago
When attempting to generate the docs for my API after switching to PHP 8 I get the following error:
In Generator.php line 193: Method ReflectionParameter::getClass() is deprecated
After some quick digging I found this to help solve the issue: https://php.watch/versions/8.0/deprecated-reflectionparameter-methods
I tested the following code in that foreach block which seems to do the trick:
foreach
foreach ($parameters as $parameter) { $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(); } }
Description:
When attempting to generate the docs for my API after switching to PHP 8 I get the following error:
After some quick digging I found this to help solve the issue: https://php.watch/versions/8.0/deprecated-reflectionparameter-methods
Proposed fix:
I tested the following code in that
foreach
block which seems to do the trick: