These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | declare(strict_types=1); |
||
3 | |||
4 | namespace WShafer\PSR11FlySystem\Cache; |
||
5 | |||
6 | use League\Flysystem\Cached\Storage\Adapter; |
||
7 | use WShafer\PSR11FlySystem\Exception\MissingConfigException; |
||
8 | use WShafer\PSR11FlySystem\Exception\MissingServiceException; |
||
9 | use WShafer\PSR11FlySystem\FlySystemManager; |
||
10 | |||
11 | class AdaptorCacheFactory extends ContainerAwareCacheAbstract |
||
12 | { |
||
13 | 5 | public function __invoke(array $options) |
|
14 | { |
||
15 | 5 | $managerServiceName = $options['managerServiceName'] ?? FlySystemManager::class; |
|
16 | |||
17 | 5 | if (empty($options['fileSystem'])) { |
|
18 | 1 | throw new MissingConfigException( |
|
19 | 1 | 'Unable to locate cache file adaptor in config' |
|
20 | ); |
||
21 | } |
||
22 | |||
23 | 4 | $fileSystem = $options['fileSystem']; |
|
24 | 4 | $fileName = $options['fileName'] ?? 'file_cache'; |
|
25 | 4 | $ttl = $options['ttl'] ?? null; |
|
26 | |||
27 | /** @var FlySystemManager $manager */ |
||
28 | 4 | $manager = $this->getService($managerServiceName); |
|
29 | |||
30 | 3 | if (!$manager->has($fileSystem)) { |
|
31 | 1 | throw new MissingServiceException( |
|
32 | 1 | 'Unable to locate file system: '.$fileSystem |
|
33 | ); |
||
34 | } |
||
35 | |||
36 | 2 | return new Adapter($manager->get($fileSystem), $fileName, $ttl); |
|
0 ignored issues
–
show
|
|||
37 | } |
||
38 | } |
||
39 |
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: