coniadev /
chuck
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Conia\Chuck\Routing; |
||
| 6 | |||
| 7 | use Closure; |
||
| 8 | use Conia\Chuck\Middleware; |
||
| 9 | use Psr\Http\Server\MiddlewareInterface as PsrMiddleware; |
||
| 10 | |||
| 11 | trait AddsMiddleware |
||
| 12 | { |
||
| 13 | /** @var list<list{non-falsy-string, ...}|Closure|Middleware|PsrMiddleware> */ |
||
|
0 ignored issues
–
show
|
|||
| 14 | protected array $middleware = []; |
||
| 15 | |||
| 16 | /** @psalm-param non-falsy-string|list{non-falsy-string, ...}|Closure|Middleware|PsrMiddleware ...$middleware */ |
||
| 17 | 44 | public function middleware(string|array|Closure|Middleware|PsrMiddleware ...$middleware): static |
|
| 18 | { |
||
| 19 | 44 | $this->middleware = array_merge($this->middleware, array_map(function ($mw) { |
|
|
0 ignored issues
–
show
It seems like
array_merge($this->middl...y_values($middleware))) of type array is incompatible with the declared type Conia\Chuck\Routing\list of property $middleware.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 20 | 34 | if (is_string($mw)) { |
|
| 21 | 9 | return [$mw]; |
|
| 22 | } |
||
| 23 | |||
| 24 | 30 | return $mw; |
|
| 25 | 44 | }, array_values($middleware))); |
|
| 26 | |||
| 27 | 44 | return $this; |
|
| 28 | } |
||
| 29 | |||
| 30 | /** @psalm-return list<list{non-falsy-string, ...}|Closure|Middleware|PsrMiddleware> */ |
||
| 31 | 30 | public function getMiddleware(): array |
|
| 32 | { |
||
| 33 | 30 | return $this->middleware; |
|
| 34 | } |
||
| 35 | |||
| 36 | /** @psalm-param list<list{non-falsy-string, ...}|Closure|Middleware|PsrMiddleware> $middleware */ |
||
| 37 | 2 | public function replaceMiddleware(array $middleware): static |
|
| 38 | { |
||
| 39 | 2 | $this->middleware = $middleware; |
|
|
0 ignored issues
–
show
It seems like
$middleware of type array is incompatible with the declared type Conia\Chuck\Routing\list of property $middleware.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 40 | |||
| 41 | 2 | return $this; |
|
| 42 | } |
||
| 43 | } |
||
| 44 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths