浏览代码

Refactor: Reduce duplication in params strategies

shalvah 2 年之前
父节点
当前提交
329b391e52

+ 2 - 6
src/Extracting/FindsFormRequestForMethod.php

@@ -15,15 +15,11 @@ trait FindsFormRequestForMethod
     {
         foreach ($method->getParameters() as $argument) {
             $argType = $argument->getType();
-            if ($argType === null || $argType instanceof ReflectionUnionType) {
-                continue;
-            }
+            if ($argType === null || $argType instanceof ReflectionUnionType) continue;
 
             $argumentClassName = $argType->getName();
 
-            if (!class_exists($argumentClassName)) {
-                continue;
-            }
+            if (!class_exists($argumentClassName)) continue;
 
             try {
                 $argumentClass = new ReflectionClass($argumentClassName);

+ 26 - 74
src/Extracting/Strategies/BodyParameters/GetFromBodyParamTag.php

@@ -2,87 +2,39 @@
 
 namespace Knuckles\Scribe\Extracting\Strategies\BodyParameters;
 
-use Knuckles\Camel\Extraction\ExtractedEndpointData;
-use Illuminate\Routing\Route;
-use Knuckles\Scribe\Extracting\FindsFormRequestForMethod;
-use Knuckles\Scribe\Extracting\ParamHelpers;
-use Knuckles\Scribe\Extracting\RouteDocBlocker;
-use Knuckles\Scribe\Extracting\Strategies\Strategy;
-use Mpociot\Reflection\DocBlock;
-use Mpociot\Reflection\DocBlock\Tag;
-use ReflectionFunctionAbstract;
+use Knuckles\Scribe\Extracting\Strategies\GetParamsFromTagStrategy;
 
-class GetFromBodyParamTag extends Strategy
+class GetFromBodyParamTag extends GetParamsFromTagStrategy
 {
-    use ParamHelpers, FindsFormRequestForMethod;
+    protected string $tagName = "bodyParam";
 
-    public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): ?array
+    public function parseTag(string $tagContent): array
     {
-        return $this->getBodyParametersFromDocBlockInFormRequestOrMethod($endpointData->route, $endpointData->method);
-    }
-
-    public function getBodyParametersFromDocBlockInFormRequestOrMethod(Route $route, ReflectionFunctionAbstract $method): array
-    {
-        // Todo v4 change to overwrite FormRequest strategy individually
-        // If there's a FormRequest, we check there for @queryParam tags.
-        if ($formRequestClass = $this->getFormRequestReflectionClass($method)) {
-            $formRequestDocBlock = new DocBlock($formRequestClass->getDocComment());
-            $bodyParametersFromDocBlock = $this->getBodyParametersFromDocBlock($formRequestDocBlock->getTags());
-
-            if (count($bodyParametersFromDocBlock)) {
-                return $bodyParametersFromDocBlock;
-            }
-        }
-
-        $methodDocBlock = RouteDocBlocker::getDocBlocksFromRoute($route)['method'];
-        return $this->getBodyParametersFromDocBlock($methodDocBlock->getTags());
-    }
-
-    /**
-     * @param Tag[] $tags
-     *
-     * @return array
-     */
-    public function getBodyParametersFromDocBlock(array $tags): array
-    {
-        $parameters = [];
-
-        foreach ($tags as $tag) {
-            if ($tag->getName() !== 'bodyParam') continue;
-
-            $tagContent = trim($tag->getContent());
-            // Format:
-            // @bodyParam <name> <type> <"required" (optional)> <description>
-            // Examples:
-            // @bodyParam text string required The text.
-            // @bodyParam user_id integer The ID of the user.
-            preg_match('/(.+?)\s+(.+?)\s+(required\s+)?([\s\S]*)/', $tagContent, $parsedContent);
-
-            if (empty($parsedContent)) {
-                // This means only name and type were supplied
-                [$name, $type] = preg_split('/\s+/', $tagContent);
-                $required = false;
+        // Format:
+        // @bodyParam <name> <type> <"required" (optional)> <description>
+        // Examples:
+        // @bodyParam text string required The text.
+        // @bodyParam user_id integer The ID of the user.
+        preg_match('/(.+?)\s+(.+?)\s+(required\s+)?([\s\S]*)/', $tagContent, $parsedContent);
+
+        if (empty($parsedContent)) {
+            // This means only name and type were supplied
+            [$name, $type] = preg_split('/\s+/', $tagContent);
+            $required = false;
+            $description = '';
+        } else {
+            [$_, $name, $type, $required, $description] = $parsedContent;
+            $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
+            if ($description == 'required') {
+                $required = $description;
                 $description = '';
-            } else {
-                [$_, $name, $type, $required, $description] = $parsedContent;
-                $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
-                if ($description == 'required') {
-                    $required = $description;
-                    $description = '';
-                }
-                $required = trim($required) === 'required';
             }
-
-            $type = $this->normalizeTypeName($type);
-            [$description, $example] = $this->parseExampleFromParamDescription($description, $type);
-
-            $example = is_null($example) && !$this->shouldExcludeExample($tagContent)
-                ? $this->generateDummyValue($type)
-                : $example;
-
-            $parameters[$name] = compact('name', 'type', 'description', 'required', 'example');
+            $required = trim($required) === 'required';
         }
 
-        return $parameters;
+        $type = $this->normalizeTypeName($type);
+        [$description, $example] = $this->getDescriptionAndExample($description, $type, $tagContent);
+
+        return compact('name', 'type', 'description', 'required', 'example');
     }
 }

+ 85 - 0
src/Extracting/Strategies/GetParamsFromTagStrategy.php

@@ -0,0 +1,85 @@
+<?php
+
+namespace Knuckles\Scribe\Extracting\Strategies;
+
+use Illuminate\Routing\Route;
+use Knuckles\Camel\Extraction\ExtractedEndpointData;
+use Knuckles\Scribe\Extracting\FindsFormRequestForMethod;
+use Knuckles\Scribe\Extracting\ParamHelpers;
+use Knuckles\Scribe\Extracting\RouteDocBlocker;
+use Knuckles\Scribe\Extracting\Strategies\Strategy;
+use Mpociot\Reflection\DocBlock;
+use Mpociot\Reflection\DocBlock\Tag;
+use ReflectionFunctionAbstract;
+
+abstract class GetParamsFromTagStrategy extends Strategy
+{
+    use ParamHelpers, FindsFormRequestForMethod;
+
+    protected string $tagName = "";
+
+    public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): ?array
+    {
+        return $this->getParametersFromDocBlockInFormRequestOrMethod($endpointData->route, $endpointData->method);
+    }
+
+    public function getParametersFromDocBlockInFormRequestOrMethod(Route $route, ReflectionFunctionAbstract $method): array
+    {
+        $classTags = RouteDocBlocker::getDocBlocksFromRoute($route)['class']?->getTags() ?: [];
+        // If there's a FormRequest, we check there for tags.
+        if ($formRequestClass = $this->getFormRequestReflectionClass($method)) {
+            $formRequestDocBlock = new DocBlock($formRequestClass->getDocComment());
+            $bodyParametersFromDocBlock = $this->getParametersFromTags($formRequestDocBlock->getTags(), $classTags);
+
+            if (count($bodyParametersFromDocBlock)) {
+                return $bodyParametersFromDocBlock;
+            }
+        }
+
+        $methodDocBlock = RouteDocBlocker::getDocBlocksFromRoute($route)['method'];
+        return $this->getParametersFromTags($methodDocBlock->getTags(), $classTags);
+    }
+
+    /**
+     * @param Tag[] $tagsOnMethod
+     * @param Tag[] $tagsOnClass
+     *
+     * @return array[]
+     */
+    public function getParametersFromTags(array $tagsOnMethod, array $tagsOnClass = []): array
+    {
+        $parameters = [];
+
+        foreach ($tagsOnClass as $tag) {
+            if (strtolower($tag->getName()) !== strtolower($this->tagName)) continue;
+
+            $parameterData = $this->parseTag(trim($tag->getContent()));
+            $parameters[$parameterData['name']] = $parameterData;
+        }
+
+        foreach ($tagsOnMethod as $tag) {
+            if (strtolower($tag->getName()) !== strtolower($this->tagName)) continue;
+
+            $parameterData = $this->parseTag(trim($tag->getContent()));
+            $parameters[$parameterData['name']] = $parameterData;
+        }
+
+        return $parameters;
+    }
+
+    abstract protected function parseTag(string $tagContent): array;
+
+    protected function getDescriptionAndExample(string $description, string $type, string $tagContent): array
+    {
+        [$description, $example] = $this->parseExampleFromParamDescription($description, $type);
+        $example = $this->setExampleIfNeeded($example, $type, $tagContent);
+        return [$description, $example];
+    }
+
+    protected function setExampleIfNeeded(mixed $currentExample, string $type, string $tagContent): mixed
+    {
+        return (is_null($currentExample) && !$this->shouldExcludeExample($tagContent))
+            ? $this->generateDummyValue($type)
+            : $currentExample;
+    }
+}

+ 47 - 95
src/Extracting/Strategies/QueryParameters/GetFromQueryParamTag.php

@@ -2,117 +2,69 @@
 
 namespace Knuckles\Scribe\Extracting\Strategies\QueryParameters;
 
-use Knuckles\Camel\Extraction\ExtractedEndpointData;
-use Illuminate\Routing\Route;
 use Illuminate\Support\Str;
-use Knuckles\Scribe\Extracting\FindsFormRequestForMethod;
-use Knuckles\Scribe\Extracting\ParamHelpers;
-use Knuckles\Scribe\Extracting\RouteDocBlocker;
-use Knuckles\Scribe\Extracting\Strategies\Strategy;
-use Mpociot\Reflection\DocBlock;
-use Mpociot\Reflection\DocBlock\Tag;
-use ReflectionFunctionAbstract;
+use Knuckles\Scribe\Extracting\Strategies\GetParamsFromTagStrategy;
 
-class GetFromQueryParamTag extends Strategy
+class GetFromQueryParamTag extends GetParamsFromTagStrategy
 {
-    use ParamHelpers, FindsFormRequestForMethod;
+    protected string $tagName = "queryParam";
 
-    public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): ?array
+    public function parseTag(string $tagContent): array
     {
-        return $this->getQueryParametersFromFormRequestOrMethod($endpointData->route, $endpointData->method);
-    }
-
-    public function getQueryParametersFromFormRequestOrMethod(Route $route, ReflectionFunctionAbstract $method): array
-    {
-        // Todo v4 change to overwrite FormRequest strategy individually
-        // If there's a FormRequest, we check there for @queryParam tags.
-        if ($formRequestClass = $this->getFormRequestReflectionClass($method)) {
-            $formRequestDocBlock = new DocBlock($formRequestClass->getDocComment());
-            $queryParametersFromDocBlock = $this->getQueryParametersFromDocBlock($formRequestDocBlock->getTags());
-
-            if (count($queryParametersFromDocBlock)) {
-                return $queryParametersFromDocBlock;
-            }
-        }
-
-        $methodDocBlock = RouteDocBlocker::getDocBlocksFromRoute($route)['method'];
-        return $this->getQueryParametersFromDocBlock($methodDocBlock->getTags());
-    }
-
-    /**
-     * @param Tag[] $tags
-     *
-     * @return array[]
-     */
-    public function getQueryParametersFromDocBlock(array $tags): array
-    {
-        $parameters = [];
-
-        foreach ($tags as $tag) {
-            if ($tag->getName() !== 'queryParam') continue;
-
-            // Format:
-            // @queryParam <name> <type (optional)> <"required" (optional)> <description>
-            // Examples:
-            // @queryParam text required The text.
-            // @queryParam user_id integer The ID of the user.
-
-            $tagContent = trim($tag->getContent());
-            preg_match('/(.+?)\s+([a-zA-Z\[\]]+\s+)?(required\s+)?([\s\S]*)/', $tagContent, $content);
-
-            if (empty($content)) {
-                // This means only name was supplied
-                $name = $tagContent;
-                $required = false;
+        // Format:
+        // @queryParam <name> <type (optional)> <"required" (optional)> <description>
+        // Examples:
+        // @queryParam text required The text.
+        // @queryParam user_id integer The ID of the user.
+        preg_match('/(.+?)\s+([a-zA-Z\[\]]+\s+)?(required\s+)?([\s\S]*)/', $tagContent, $content);
+
+        if (empty($content)) {
+            // This means only name was supplied
+            $name = $tagContent;
+            $required = false;
+            $description = '';
+            $type = 'string';
+        } else {
+            [$_, $name, $type, $required, $description] = $content;
+
+            $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
+            if ($description === 'required') {
+                // No description was supplied
+                $required = true;
                 $description = '';
-                $type = 'string';
             } else {
-                [$_, $name, $type, $required, $description] = $content;
+                $required = trim($required) === 'required';
+            }
 
-                $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
-                if ($description === 'required') {
-                    // No description was supplied
+            $type = trim($type);
+            if ($type) {
+                if ($type === 'required') {
+                    // Type wasn't supplied
+                    $type = 'string';
                     $required = true;
-                    $description = '';
                 } else {
-                    $required = trim($required) === 'required';
-                }
-
-                $type = trim($type);
-                if ($type) {
-                    if ($type === 'required') {
-                        // Type wasn't supplied
-                        $type = 'string';
-                        $required = true;
-                    } else {
-                        $type = $this->normalizeTypeName($type);
-                        // Type in annotation is optional
-                        if (!$this->isSupportedTypeInDocBlocks($type)) {
-                            // Then that wasn't a type, but part of the description
-                            $description = trim("$type $description");
-                            $type = '';
-                        }
+                    $type = $this->normalizeTypeName($type);
+                    // Type in annotation is optional
+                    if (!$this->isSupportedTypeInDocBlocks($type)) {
+                        // Then that wasn't a type, but part of the description
+                        $description = trim("$type $description");
+                        $type = '';
                     }
-                } else if ($this->isSupportedTypeInDocBlocks($description)) {
-                    // Only type was supplied
-                    $type = $description;
-                    $description = '';
                 }
-
-                $type = empty($type)
-                    ? (Str::contains(strtolower($description), ['number', 'count', 'page']) ? 'integer' : 'string')
-                    : $this->normalizeTypeName($type);
-
+            } else if ($this->isSupportedTypeInDocBlocks($description)) {
+                // Only type was supplied
+                $type = $description;
+                $description = '';
             }
 
-            [$description, $example] = $this->parseExampleFromParamDescription($description, $type);
-            if (is_null($example) && !$this->shouldExcludeExample($tagContent)) {
-                $example = $this->generateDummyValue($type);
-            }
+            $type = empty($type)
+                ? (Str::contains(strtolower($description), ['number', 'count', 'page']) ? 'integer' : 'string')
+                : $this->normalizeTypeName($type);
 
-            $parameters[$name] = compact('name', 'description', 'required', 'example', 'type');
         }
 
-        return $parameters;
+        [$description, $example] = $this->getDescriptionAndExample($description, $type, $tagContent);
+
+        return compact('name', 'description', 'required', 'example', 'type');
     }
 }

+ 34 - 94
src/Extracting/Strategies/UrlParameters/GetFromUrlParamTag.php

@@ -2,112 +2,52 @@
 
 namespace Knuckles\Scribe\Extracting\Strategies\UrlParameters;
 
-use Knuckles\Camel\Extraction\ExtractedEndpointData;
-use Dingo\Api\Http\FormRequest as DingoFormRequest;
-use Illuminate\Foundation\Http\FormRequest as LaravelFormRequest;
 use Illuminate\Support\Str;
-use Knuckles\Scribe\Extracting\ParamHelpers;
-use Knuckles\Scribe\Extracting\RouteDocBlocker;
-use Knuckles\Scribe\Extracting\Strategies\Strategy;
-use Mpociot\Reflection\DocBlock;
-use Mpociot\Reflection\DocBlock\Tag;
-use ReflectionClass;
-use ReflectionException;
-use ReflectionUnionType;
+use Knuckles\Scribe\Extracting\Strategies\GetParamsFromTagStrategy;
 
-class GetFromUrlParamTag extends Strategy
+class GetFromUrlParamTag extends GetParamsFromTagStrategy
 {
-    use ParamHelpers;
+    protected string $tagName = "urlParam";
 
-    public function __invoke(ExtractedEndpointData $endpointData, array $routeRules): ?array
+    protected function parseTag(string $tagContent): array
     {
-        foreach ($endpointData->method->getParameters() as $param) {
-            $paramType = $param->getType();
-            if ($paramType === null || $paramType instanceof ReflectionUnionType) {
-                continue;
-            }
-
-            $parameterClassName = $paramType->getName();
-
-            try {
-                $parameterClass = new ReflectionClass($parameterClassName);
-            } catch (ReflectionException $e) {
-                continue;
-            }
-
-            // If there's a FormRequest, we check there for @urlParam tags.
-            if (class_exists(LaravelFormRequest::class) && $parameterClass->isSubclassOf(LaravelFormRequest::class)
-                || class_exists(DingoFormRequest::class) && $parameterClass->isSubclassOf(DingoFormRequest::class)) {
-                $formRequestDocBlock = new DocBlock($parameterClass->getDocComment());
-                $urlParametersFromDocBlock = $this->getUrlParametersFromDocBlock($formRequestDocBlock->getTags());
-
-                if (count($urlParametersFromDocBlock)) {
-                    return $urlParametersFromDocBlock;
-                }
-            }
-        }
-
-        $methodDocBlock = RouteDocBlocker::getDocBlocksFromRoute($endpointData->route)['method'];
-
-        return $this->getUrlParametersFromDocBlock($methodDocBlock->getTags());
-    }
-
-    /**
-     * @param Tag[] $tags
-     *
-     * @return array[]
-     */
-    public function getUrlParametersFromDocBlock(array $tags): array
-    {
-        $parameters = [];
-
-        foreach ($tags as $tag) {
-            if ($tag->getName() !== 'urlParam') continue;
-
-            $tagContent = trim($tag->getContent());
-            // Format:
-            // @urlParam <name> <type (optional)> <"required" (optional)> <description>
-            // Examples:
-            // @urlParam id string required The id of the post.
-            // @urlParam user_id The ID of the user.
-
-            // We match on all the possible types for URL parameters. It's a limited range, so no biggie.
-            preg_match('/(\w+?)\s+((int|integer|string|float|double|number)\s+)?(required\s+)?([\s\S]*)/', $tagContent, $content);
-            if (empty($content)) {
-                // This means only name was supplied
-                $name = trim($tagContent);
-                $required = false;
+        // Format:
+        // @urlParam <name> <type (optional)> <"required" (optional)> <description>
+        // Examples:
+        // @urlParam id string required The id of the post.
+        // @urlParam user_id The ID of the user.
+
+        // We match on all the possible types for URL parameters. It's a limited range, so no biggie.
+        preg_match('/(\w+?)\s+((int|integer|string|float|double|number)\s+)?(required\s+)?([\s\S]*)/', $tagContent, $content);
+        if (empty($content)) {
+            // This means only name was supplied
+            $name = $tagContent;
+            $required = false;
+            $description = '';
+            $type = 'string';
+        } else {
+            [$_, $name, $__, $type, $required, $description] = $content;
+            $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
+            if ($description === 'required') {
+                $required = true;
                 $description = '';
-                $type = 'string';
             } else {
-                [$_, $name, $__, $type, $required, $description] = $content;
-                $description = trim(str_replace(['No-example.', 'No-example'], '', $description));
-                if ($description === 'required') {
-                    $required = true;
-                    $description = '';
-                } else {
-                    $required = trim($required) === 'required';
-                }
-
-                if (empty($type) && $this->isSupportedTypeInDocBlocks($description)) {
-                    // Only type was supplied
-                    $type = $description;
-                    $description = '';
-                }
-
-                $type = empty($type)
-                    ? (Str::contains($description, ['number', 'count', 'page']) ? 'integer' : 'string')
-                    : $this->normalizeTypeName($type);
+                $required = trim($required) === 'required';
             }
 
-            [$description, $example] = $this->parseExampleFromParamDescription($description, $type);
-            if (is_null($example) && !$this->shouldExcludeExample($tagContent)) {
-                $example = $this->generateDummyValue($type);
+            if (empty($type) && $this->isSupportedTypeInDocBlocks($description)) {
+                // Only type was supplied
+                $type = $description;
+                $description = '';
             }
 
-            $parameters[$name] = compact('name', 'description', 'required', 'example', 'type');
+            $type = empty($type)
+                ? (Str::contains($description, ['number', 'count', 'page']) ? 'integer' : 'string')
+                : $this->normalizeTypeName($type);
         }
 
-        return $parameters;
+        [$description, $example] = $this->getDescriptionAndExample($description, $type, $tagContent);
+
+        return compact('name', 'description', 'required', 'example', 'type');
     }
 }

+ 4 - 4
tests/Strategies/BodyParameters/GetFromBodyParamTagTest.php

@@ -35,7 +35,7 @@ class GetFromBodyParamTagTest extends TestCase
             new Tag('bodyParam', 'users[].first_name string The first name of the user. Example: John'),
             new Tag('bodyParam', 'users[].last_name string The last name of the user. Example: Doe'),
         ];
-        $results = $strategy->getBodyParametersFromDocBlock($tags);
+        $results = $strategy->getParametersFromTags($tags);
 
         $this->assertArraySubset([
             'user_id' => [
@@ -131,7 +131,7 @@ class GetFromBodyParamTagTest extends TestCase
             new Tag('bodyParam', '[].contacts[].last_name string The last name of the contact. Example: Doe'),
             new Tag('bodyParam', '[].roles string[] The name of the role. Example: ["Admin"]'),
         ];
-        $results = $strategy->getBodyParametersFromDocBlock($tags);
+        $results = $strategy->getParametersFromTags($tags);
 
         $this->assertArraySubset([
             '[].first_name' => [
@@ -174,7 +174,7 @@ class GetFromBodyParamTagTest extends TestCase
         $route = new Route(['POST'], "/withFormRequestParameter", ['uses' => [TestController::class, 'withFormRequestParameter']]);
 
         $strategy = new GetFromBodyParamTag(new DocumentationConfig([]));
-        $results = $strategy->getBodyParametersFromDocBlockInFormRequestOrMethod($route, $method);
+        $results = $strategy->getParametersFromDocBlockInFormRequestOrMethod($route, $method);
 
         $this->assertArraySubset([
             'user_id' => [
@@ -216,7 +216,7 @@ class GetFromBodyParamTagTest extends TestCase
         $route = new Route(['POST'], "/$methodName", ['uses' => [TestController::class, $methodName]]);
 
         $strategy = new GetFromBodyParamTag(new DocumentationConfig([]));
-        $results = $strategy->getBodyParametersFromDocBlockInFormRequestOrMethod($route, $method);
+        $results = $strategy->getParametersFromDocBlockInFormRequestOrMethod($route, $method);
 
         $this->assertArraySubset([
             'direct_one' => [

+ 3 - 4
tests/Strategies/QueryParameters/GetFromQueryParamTagTest.php

@@ -31,7 +31,7 @@ class GetFromQueryParamTagTest extends TestCase
             new Tag('queryParam', 'noExampleNoDescription No-example.'),
             new Tag('queryParam', 'noExample Something No-example'),
         ];
-        $results = $strategy->getQueryParametersFromDocBlock($tags);
+        $results = $strategy->getParametersFromTags($tags);
 
         $this->assertArraySubset([
             'location_id' => [
@@ -104,10 +104,10 @@ class GetFromQueryParamTagTest extends TestCase
     {
         $methodName = 'withFormRequestParameter';
         $method = new \ReflectionMethod(TestController::class, $methodName);
-        $route = new Route(['POST'], "/$methodName", ['uses' => TestController::class . "@$methodName"]);
+        $route = new Route(['POST'], "/$methodName", ['uses' => [TestController::class, $methodName]]);
 
         $strategy = new GetFromQueryParamTag(new DocumentationConfig([]));
-        $results = $strategy->getQueryParametersFromFormRequestOrMethod($route, $method);
+        $results = $strategy->getParametersFromDocBlockInFormRequestOrMethod($route, $method);
 
         $this->assertArraySubset([
             'location_id' => [
@@ -127,5 +127,4 @@ class GetFromQueryParamTagTest extends TestCase
         ], $results);
     }
 
-
 }

+ 1 - 1
tests/Strategies/UrlParameters/GetFromUrlParamTagTest.php

@@ -29,7 +29,7 @@ class GetFromUrlParamTagTest extends TestCase
             new Tag('urlParam', 'noExampleNoDescription No-example.'),
             new Tag('urlParam', 'noExample Something No-example'),
         ];
-        $results = $strategy->getUrlParametersFromDocBlock($tags);
+        $results = $strategy->getParametersFromTags($tags);
 
         $this->assertArraySubset([
             'id' => [

+ 1 - 2
tests/Unit/ExtractorPluginSystemTest.php

@@ -163,8 +163,7 @@ class ExtractorPluginSystemTest extends TestCase
 
     public function createRoute(string $httpMethod, string $path, string $controllerMethod, $register = false, $class = TestController::class)
     {
-
-        return new Route([$httpMethod], $path, ['uses' => $class . "@$controllerMethod"]);
+        return new Route([$httpMethod], $path, ['uses' => [$class, $controllerMethod]]);
     }
 }