1 | <?php declare(strict_types=1); |
||
14 | class Dispatcher extends GroupCountBasedDispatcher implements |
||
15 | MiddlewareAwareInterface, |
||
16 | RequestHandlerInterface, |
||
17 | StrategyAwareInterface |
||
18 | { |
||
19 | use MiddlewareAwareTrait; |
||
20 | use StrategyAwareTrait; |
||
21 | |||
22 | /** |
||
23 | * Dispatch the current route. |
||
24 | * |
||
25 | * @param \Psr\Http\Message\ServerRequestInterface $request |
||
26 | * |
||
27 | * @return \Psr\Http\Message\ResponseInterface |
||
28 | */ |
||
29 | 26 | public function dispatchRequest(ServerRequestInterface $request) : ResponseInterface |
|
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | 26 | public function handle(ServerRequestInterface $request) : ResponseInterface |
|
63 | |||
64 | /** |
||
65 | * Handle dispatching of a found route. |
||
66 | * |
||
67 | * @param \League\Route\Route $route |
||
68 | * @param array $vars |
||
|
|||
69 | * |
||
70 | * @return void |
||
71 | */ |
||
72 | 10 | protected function setFoundMiddleware(Route $route) : void |
|
73 | { |
||
74 | 10 | if (! is_null($route->getStrategy())) { |
|
75 | 10 | $route->setStrategy($this->getStrategy()); |
|
76 | } |
||
77 | |||
78 | // wrap entire dispatch process in exception handler |
||
79 | 10 | $this->prependMiddleware($route->getStrategy()->getExceptionHandler()); |
|
80 | |||
81 | // add group and route specific niddlewares |
||
82 | 10 | if ($group = $route->getParentGroup()) { |
|
83 | 2 | $this->middlewares($group->getMiddlewareStack()); |
|
84 | } |
||
85 | |||
86 | 10 | $this->middlewares($route->getMiddlewareStack()); |
|
87 | |||
88 | // add actual route to end of stack |
||
89 | 10 | $this->middleware($route); |
|
90 | 10 | } |
|
91 | |||
92 | /** |
||
93 | * Handle a not found route. |
||
94 | * |
||
95 | * @return void |
||
96 | */ |
||
97 | 12 | protected function setNotFoundDecoratorMiddleware() : void |
|
102 | |||
103 | /** |
||
104 | * Handles a not allowed route. |
||
105 | * |
||
106 | * @param array $allowed |
||
107 | * |
||
108 | * @return void |
||
109 | */ |
||
110 | 4 | protected function setMethodNotAllowedDecoratorMiddleware(array $allowed) : void |
|
118 | } |
||
119 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.