1 | <?php |
||
22 | final class CacheMiddleware implements Middleware |
||
23 | { |
||
24 | /** |
||
25 | * Cache namespace used for this repository. |
||
26 | */ |
||
27 | const CACHE_NAMESPACE = 'Documentation\\Api\\Php'; |
||
28 | |||
29 | /** |
||
30 | * Cache pool used to store files. |
||
31 | * |
||
32 | * @var Pool |
||
33 | */ |
||
34 | private $dataStore; |
||
35 | |||
36 | private $enabled = true; |
||
37 | |||
38 | 2 | public function __construct(Pool $dataStore) |
|
42 | |||
43 | public function disable() |
||
47 | |||
48 | /** |
||
49 | * Executes this middle ware class. |
||
50 | * A middle ware class MUST return a File object or call the $next callable. |
||
51 | * |
||
52 | * @param CreateCommand $command |
||
53 | * @param callable $next |
||
54 | * |
||
55 | * @return File |
||
56 | */ |
||
57 | 2 | public function execute($command, callable $next) |
|
78 | |||
79 | /** |
||
80 | * @param CreateCommand $command |
||
81 | * @param callable $next |
||
82 | * @param Item $item |
||
83 | * @return mixed |
||
84 | */ |
||
85 | 2 | private function updateCache(CreateCommand $command, callable $next, $item) |
|
92 | |||
93 | /** |
||
94 | * Convert path to ItemName |
||
95 | * |
||
96 | * @param path |
||
97 | * @return string |
||
98 | */ |
||
99 | 2 | private function getItemName($path) |
|
103 | } |
||
104 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.