1 | <?php |
||
17 | class Dispatcher implements MiddlewareInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var callable middleware resolver |
||
21 | */ |
||
22 | private $resolver; |
||
23 | |||
24 | /** |
||
25 | * @var mixed[] unresolved middleware stack |
||
26 | */ |
||
27 | private $stack; |
||
28 | |||
29 | /** |
||
30 | * @param (callable|MiddlewareInterface|mixed)[] $stack middleware stack (with at least one middleware component) |
||
31 | * @param callable|null $resolver optional middleware resolver: |
||
32 | * function (string $name): MiddlewareInterface |
||
33 | * |
||
34 | * @throws InvalidArgumentException if an empty middleware stack was given |
||
35 | */ |
||
36 | 1 | public function __construct($stack, callable $resolver = null) |
|
45 | |||
46 | /** |
||
47 | * Dispatches the middleware stack and returns the resulting `ResponseInterface`. |
||
48 | * |
||
49 | * @param RequestInterface $request |
||
50 | * |
||
51 | * @return ResponseInterface |
||
52 | * |
||
53 | * @throws LogicException on unexpected result from any middleware on the stack |
||
54 | */ |
||
55 | 1 | public function dispatch(RequestInterface $request) |
|
61 | |||
62 | /** |
||
63 | * @inheritdoc |
||
64 | */ |
||
65 | 1 | public function process(RequestInterface $request, DelegateInterface $delegate) |
|
77 | |||
78 | /** |
||
79 | * @param int $index middleware stack index |
||
80 | * |
||
81 | * @return Delegate |
||
82 | */ |
||
83 | 1 | private function resolve($index) |
|
122 | } |
||
123 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: