1 | <?php |
||
23 | abstract class Controller implements ControllerInterface |
||
24 | { |
||
25 | |||
26 | /** |
||
27 | * @var ServerRequestInterface|Request |
||
28 | */ |
||
29 | protected $request; |
||
30 | |||
31 | /** |
||
32 | * @var ResponseInterface|Response |
||
33 | */ |
||
34 | protected $response; |
||
35 | |||
36 | /** |
||
37 | * Registers the current HTTP request and response |
||
38 | * |
||
39 | * @param ServerRequestInterface $request |
||
40 | * @param ResponseInterface $response |
||
41 | * |
||
42 | * @return Controller|$this|self|ControllerInterface |
||
43 | */ |
||
44 | 20 | public function register( |
|
51 | |||
52 | /** |
||
53 | * Gets updated HTTP response |
||
54 | * |
||
55 | * @return ResponseInterface |
||
56 | */ |
||
57 | 10 | public function getResponse() |
|
61 | |||
62 | /** |
||
63 | * Gets updated HTTP request |
||
64 | * |
||
65 | * @return ServerRequestInterface |
||
66 | */ |
||
67 | 14 | public function getRequest() |
|
71 | |||
72 | /** |
||
73 | * Sets a value to be used by render |
||
74 | * |
||
75 | * The key argument can be an associative array with values to be set |
||
76 | * or a string naming the passed value. If an array is given then the |
||
77 | * value will be ignored. |
||
78 | * |
||
79 | * Those values must be set in the request attributes so they can be used |
||
80 | * latter by any other middle ware in the stack. |
||
81 | * |
||
82 | * @param string|array $key |
||
83 | * @param mixed $value |
||
84 | * |
||
85 | * @return Controller|$this|self|ControllerInterface |
||
86 | */ |
||
87 | 8 | public function set($key, $value = null) |
|
98 | |||
99 | /** |
||
100 | * Enables or disables rendering |
||
101 | * |
||
102 | * @param bool $disable |
||
103 | * @return ControllerInterface|self|$this |
||
104 | */ |
||
105 | 2 | public function disableRendering($disable = true) |
|
110 | |||
111 | /** |
||
112 | * Changes the current rendering template |
||
113 | * |
||
114 | * @param string $template |
||
115 | * @return ControllerInterface|self|$this |
||
116 | */ |
||
117 | 2 | public function setView($template) |
|
122 | |||
123 | /** |
||
124 | * Redirects the flow to another route/path |
||
125 | * |
||
126 | * @param string $path the route or path to redirect to |
||
127 | * |
||
128 | * @return Controller|self|$this |
||
129 | */ |
||
130 | 4 | public function redirect($path) |
|
148 | |||
149 | /** |
||
150 | * Register a variable value |
||
151 | * |
||
152 | * @param string $key |
||
153 | * @param mixed $value |
||
154 | * |
||
155 | * @return Controller|$this|self |
||
156 | */ |
||
157 | 8 | protected function registerVar($key, $value) |
|
166 | |||
167 | /** |
||
168 | * Return Router path generator |
||
169 | * |
||
170 | * @return \Aura\Router\Generator |
||
171 | */ |
||
172 | 2 | protected function getRouterGenerator() |
|
178 | |||
179 | /** |
||
180 | * Creates a redirect response for provided path |
||
181 | * |
||
182 | * @param string $path |
||
183 | * |
||
184 | * @return Response |
||
185 | */ |
||
186 | 4 | protected function createRedirectResponse($path) |
|
192 | } |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: