1 | <?php declare(strict_types=1); |
||
9 | trait MiddlewareAwareTrait |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $middleware = []; |
||
15 | |||
16 | /** |
||
17 | * {@inheritdoc} |
||
18 | */ |
||
19 | 16 | public function middleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface |
|
25 | |||
26 | /** |
||
27 | * {@inheritdoc} |
||
28 | */ |
||
29 | 2 | public function middlewares(array $middlewares) : MiddlewareAwareInterface |
|
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | 30 | public function prependMiddleware(MiddlewareInterface $middleware) : MiddlewareAwareInterface |
|
47 | |||
48 | /** |
||
49 | * Add a middleware as a class name to the stack |
||
50 | * |
||
51 | * @param string $middleware |
||
52 | * |
||
53 | * @return static |
||
54 | */ |
||
55 | 2 | public function lazyMiddleware(string $middleware) : MiddlewareAwareInterface |
|
61 | |||
62 | /** |
||
63 | * Add multiple middlewares as class names to the stack |
||
64 | * |
||
65 | * @param string[] $middlewares |
||
66 | * |
||
67 | * @return static |
||
68 | */ |
||
69 | public function lazyMiddlewares(array $middlewares) : MiddlewareAwareInterface |
||
77 | |||
78 | /** |
||
79 | * Prepend a middleware as a class name to the stack |
||
80 | * |
||
81 | * @param string $middleware |
||
82 | * |
||
83 | * @return static |
||
84 | */ |
||
85 | public function lazyPrependMiddleware(string $middleware) : MiddlewareAwareInterface |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | */ |
||
95 | 30 | public function shiftMiddleware() : MiddlewareInterface |
|
99 | |||
100 | /** |
||
101 | * {@inheritdoc} |
||
102 | */ |
||
103 | 32 | public function getMiddlewareStack() : iterable |
|
107 | |||
108 | /** |
||
109 | * Resolve a middleware implementation, optionally from a container |
||
110 | * |
||
111 | * @param \Psr\Http\Server\MiddlewareInterface|string $middleware |
||
112 | * @param \Psr\Container\ContainerInterface|null $container |
||
113 | * |
||
114 | * @return \Psr\Http\Server\MiddlewareInterface |
||
115 | */ |
||
116 | 2 | protected function resolveMiddleware($middleware, ?ContainerInterface $container = null) : MiddlewareInterface |
|
132 | } |
||
133 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.