Conditions | 3 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
13 | public function __invoke(array $options) |
||
14 | { |
||
15 | $flyManagerServiceName = $options['flyManagerServiceName'] ?? FlySystemManager::class; |
||
16 | |||
17 | if (empty($options['fileSystem'])) { |
||
18 | throw new MissingConfigException( |
||
19 | 'Unable to locate cache file adaptor in config' |
||
20 | ); |
||
21 | } |
||
22 | |||
23 | $fileSystem = $options['fileSystem']; |
||
24 | $fileName = $options['fileName'] ?? 'file_cache'; |
||
25 | $ttl = $options['ttl'] ?? null; |
||
26 | |||
27 | /** @var FlySystemManager $manager */ |
||
28 | $manager = $this->getService($flyManagerServiceName); |
||
29 | |||
30 | if (!$manager->has($fileSystem)) { |
||
31 | throw new MissingServiceException( |
||
32 | 'Unable to locate file system: '.$fileSystem |
||
33 | ); |
||
34 | } |
||
35 | |||
36 | return new Adapter($manager->get($fileSystem), $fileName, $ttl); |
||
|
|||
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: