1 | <?php |
||
11 | abstract class EndPoint implements RequestHandlerInterface |
||
12 | { |
||
13 | /** @var string|null */ |
||
14 | protected $controller; |
||
15 | /** @var string|null */ |
||
16 | protected $action; |
||
17 | /** @var string */ |
||
18 | protected $prefix = ''; |
||
19 | |||
20 | public function __construct(array $params = []) |
||
28 | |||
29 | /** |
||
30 | * @param ServerRequestInterface $request |
||
31 | * |
||
32 | * @return ResponseInterface |
||
33 | * @throws \BadMethodCallException |
||
34 | */ |
||
35 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
43 | |||
44 | /** |
||
45 | * Get params from router and remove all protected params (_controller/_action/_other) |
||
46 | * |
||
47 | * @param Route $route |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function getParams(Route $route): array |
||
56 | |||
57 | /** |
||
58 | * @param ServerRequestInterface $request |
||
59 | * |
||
60 | * @return callable |
||
61 | * @throws \BadMethodCallException |
||
62 | */ |
||
63 | protected function getPoint(ServerRequestInterface $request) : callable |
||
75 | |||
76 | abstract protected function getControllerClass(ServerRequestInterface $request); |
||
77 | |||
78 | /** |
||
79 | * @param string $controller |
||
80 | * @throws \BadMethodCallException |
||
81 | */ |
||
82 | protected function checkController(string $controller) : void |
||
88 | |||
89 | /** |
||
90 | * @param \object $controller |
||
|
|||
91 | * @param string $action |
||
92 | * @throws \BadMethodCallException |
||
93 | */ |
||
94 | protected function checkAction(object $controller, string $action) : void |
||
100 | |||
101 | protected function getAction(ServerRequestInterface $request): ?string |
||
107 | |||
108 | protected function getRoute(ServerRequestInterface $request): Route |
||
112 | } |
||
113 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.