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\CData; |
||
17 | |||
18 | class FuseDirFillCData extends CData |
||
19 | { |
||
20 | public function __invoke(CData $dirhandle, string $name, int $type, int $ino): int |
||
21 | { |
||
22 | |||
23 | } |
||
0 ignored issues
–
show
|
|||
24 | } |
||
25 | |||
26 | class FuseFillDirCData extends CData |
||
27 | { |
||
28 | public function __invoke(CData $buf, string $name, ?CData $stbuf, int $off): int |
||
29 | { |
||
30 | |||
31 | } |
||
0 ignored issues
–
show
In this branch, the function will implicitly return
null which is incompatible with the type-hinted return integer . Consider adding a return statement or allowing null as return value.
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: interface ReturnsInt {
public function returnsIntHinted(): int;
}
class MyClass implements ReturnsInt {
public function returnsIntHinted(): int
{
if (foo()) {
return 123;
}
// here: null is implicitly returned
}
}
![]() |
|||
32 | } |
For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example: