sj-i /
php-fuse
| 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\Libc\Fuse; |
||
| 15 | |||
| 16 | use FFI\CData; |
||
| 17 | use Fuse\Libc\Sys\Stat\Stat; |
||
| 18 | use TypedCData\TypedCDataInterface; |
||
|
0 ignored issues
–
show
|
|||
| 19 | |||
| 20 | /** |
||
| 21 | * typedef int (*fuse_fill_dir_t) (void *buf, const char *name, const struct stat *stbuf, off_t off); |
||
| 22 | */ |
||
| 23 | final class FuseFillDir implements TypedCDataInterface |
||
| 24 | { |
||
| 25 | /** @var \Fuse\FuseFillDirCData */ |
||
| 26 | private CData $cdata; |
||
| 27 | |||
| 28 | public function __invoke(FuseReadDirBuffer $buf, string $name, ?Stat $stbuf, int $off): int |
||
| 29 | { |
||
| 30 | if (!is_null($stbuf)) { |
||
| 31 | $stbuf = $stbuf->toCData($stbuf->newCData()); |
||
| 32 | } |
||
| 33 | /** @var int */ |
||
| 34 | return ($this->cdata)($buf->toCData(null), $name, $stbuf, $off); |
||
| 35 | } |
||
| 36 | |||
| 37 | public static function getCTypeName(): string |
||
| 38 | { |
||
| 39 | return 'fuse_fill_dir_t'; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** @param \Fuse\FuseFillDirCData $cdata */ |
||
| 43 | public function __construct(CData $cdata) |
||
| 44 | { |
||
| 45 | $this->cdata = $cdata; |
||
|
0 ignored issues
–
show
$cdata is of type FFI\CData, but the property $cdata was declared to be of type Fuse\FuseFillDirCData. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?
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. class Alien {}
class Dalek extends Alien {}
class Plot
{
/** @var Dalek */
public $villain;
}
$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
$plot->villain = $alien;
}
Loading history...
|
|||
| 46 | } |
||
| 47 | |||
| 48 | /** @return static */ |
||
| 49 | public static function fromCData(CData $cdata): self |
||
| 50 | { |
||
| 51 | /** @var \Fuse\FuseFillDirCData $cdata */ |
||
| 52 | return new self($cdata); |
||
| 53 | } |
||
| 54 | |||
| 55 | public function toCData(CData $cdata): CData |
||
| 56 | { |
||
| 57 | return $cdata; |
||
| 58 | } |
||
| 59 | |||
| 60 | public static function newCData(): CData |
||
| 61 | { |
||
| 62 | throw new \LogicException('this type doesn\'t support creation of CData'); |
||
| 63 | } |
||
| 64 | } |
||
| 65 |
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.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths