diff --git a/modules/registrars/openprovider/OpenProvider/API/ParamsCreator.php b/modules/registrars/openprovider/OpenProvider/API/ParamsCreator.php index abddecee..6e871262 100644 --- a/modules/registrars/openprovider/OpenProvider/API/ParamsCreator.php +++ b/modules/registrars/openprovider/OpenProvider/API/ParamsCreator.php @@ -2,9 +2,7 @@ namespace OpenProvider\API; -use phpDocumentor\Reflection\DocBlockFactory; use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; -use function GuzzleHttp\Psr7\_caseless_remove; class ParamsCreator { @@ -188,14 +186,17 @@ private function argsCollect(object $class, string $method, object $body): array * @param \ReflectionMethod $method * @return array */ - private function getMethodParamsTypes(\ReflectionMethod $method) + private function getMethodParamsTypes(\ReflectionMethod $method): array { - $factory = DocBlockFactory::createInstance(); - $docblock = $factory->create($method->getDocComment()); + $doc = $method->getDocComment(); + if ($doc === false) { + return []; + } + $paramTags = []; - foreach ($docblock->getTagsByName('param') as $tag) { - /** @var $tag \phpDocumentor\Reflection\DocBlock\Tags\Param */ - $paramTags[$tag->getVariableName()] = (string)$tag->getType(); + preg_match_all('/@param\s+(\S+)\s+\$(\w+)/', $doc, $matches, PREG_SET_ORDER); + foreach ($matches as $match) { + $paramTags[$match[2]] = explode('|', $match[1])[0]; } return $paramTags;