1 | <?php |
||||
2 | |||||
3 | /** |
||||
4 | * This file is part of the sj-i/php-fuse package. |
||||
5 | * |
||||
6 | * (c) sji <[email protected]> |
||||
7 | * |
||||
8 | * For the full copyright and license information, please view the LICENSE |
||||
9 | * file that was distributed with this source code. |
||||
10 | */ |
||||
11 | |||||
12 | declare(strict_types=1); |
||||
13 | |||||
14 | namespace Fuse; |
||||
15 | |||||
16 | use FFI; |
||||
17 | use FFI\CData; |
||||
18 | use Fuse\Libc\Fuse\FuseIoctlDataPointer; |
||||
19 | |||||
20 | final class Fuse |
||||
21 | { |
||||
22 | private static ?self $instance; |
||||
23 | /** @var FuseFFI */ |
||||
24 | public FFI $ffi; |
||||
25 | |||||
26 | /** |
||||
27 | * @param FuseFFI $ffi |
||||
28 | */ |
||||
29 | private function __construct(FFI $ffi) |
||||
30 | { |
||||
31 | $this->ffi = $ffi; |
||||
0 ignored issues
–
show
|
|||||
32 | } |
||||
33 | |||||
34 | /** |
||||
35 | * @return FuseFFI |
||||
36 | */ |
||||
37 | private static function load(): FFI |
||||
38 | { |
||||
39 | /** @var FuseFFI */ |
||||
40 | return FFI::cdef( |
||||
41 | file_get_contents(__DIR__ . '/Headers/fuse.h'), |
||||
42 | 'libfuse.so' |
||||
43 | ); |
||||
44 | } |
||||
45 | |||||
46 | public static function getInstance(): self |
||||
47 | { |
||||
48 | if (!isset(self::$instance)) { |
||||
49 | self::$instance = new self(self::load()); |
||||
50 | } |
||||
51 | return self::$instance; |
||||
0 ignored issues
–
show
|
|||||
52 | } |
||||
53 | |||||
54 | /** |
||||
55 | * @param list<string> $args |
||||
0 ignored issues
–
show
The type
Fuse\list was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
56 | * @param FuseOperations $fuse_operations |
||||
57 | * @param CData|null $user_data |
||||
58 | * @return int |
||||
59 | */ |
||||
60 | public function main(array $args, FuseOperations $fuse_operations, ?CData $user_data = null): int |
||||
61 | { |
||||
62 | $argc = count($args); |
||||
63 | /** @var \FFI\CDataArray $argv_real */ |
||||
64 | $argv_real = FFI::new('char *[' . count($args) . ']'); |
||||
65 | foreach ($args as $key => $item) { |
||||
66 | $item_len = strlen($item); |
||||
67 | $item_len_nul = $item_len + 1; |
||||
68 | /** @var \FFI\CDataArray $argv_item */ |
||||
69 | $argv_item = FFI::new("char[{$item_len_nul}]", false, true); |
||||
70 | FFI::memcpy($argv_item, $item, $item_len); |
||||
71 | $argv_item[$item_len] = "\0"; |
||||
72 | $argv_real[$key] = $argv_item; |
||||
73 | } |
||||
74 | |||||
75 | return Fuse::getInstance()->ffi->fuse_main_real( |
||||
0 ignored issues
–
show
The method
fuse_main_real() does not exist on FFI . Are you sure you never get this type here, but always one of the subclasses?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
76 | $argc, |
||||
77 | $argv_real, |
||||
78 | FFI::addr($fuse_operations->getCData()), |
||||
79 | $fuse_operations->getSize(), |
||||
80 | $user_data |
||||
81 | ); |
||||
82 | } |
||||
83 | } |
||||
84 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.