Issues (200)

tools/stubs/ffi/libc.php (23 issues)

1
<?php
2
namespace FFI\Libc;
3
use FFI\CData;
4
use FFI\CInteger;
5
6
/**
7
 * This file is part of the sj-i/php-profiler package.
8
 *
9
 * (c) sji <[email protected]>
10
 *
11
 * For the full copyright and license information, please view the LICENSE
12
 * file that was distributed with this source code.
13
 */
14
15
class iovec extends CData
16
{
17
    /** @var int|CInteger  */
18
    public int $iov_base;
19
    /** @var int|CInteger  */
20
    public int $iov_len;
21
}
22
23
class process_vm_readv_ffi extends \FFI
24
{
25
    /** @var int|CInteger */
26
    public int $errno;
27
28
    /**
29
     * @param int $pid
30
     * @param CData $local_iov_addr
31
     * @param int $liovcnt
32
     * @param CData $remote_iov_addr
33
     * @param int $riovcnt
34
     * @param int $flags
35
     * @return int|CInteger
36
     */
37
    public function process_vm_readv(int $pid, CData $local_iov_addr, int $liovcnt, CData $remote_iov_addr, int $riovcnt, int $flags): int {}
0 ignored issues
show
The parameter $flags is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(int $pid, CData $local_iov_addr, int $liovcnt, CData $remote_iov_addr, int $riovcnt, /** @scrutinizer ignore-unused */ int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $pid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(/** @scrutinizer ignore-unused */ int $pid, CData $local_iov_addr, int $liovcnt, CData $remote_iov_addr, int $riovcnt, int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $remote_iov_addr is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(int $pid, CData $local_iov_addr, int $liovcnt, /** @scrutinizer ignore-unused */ CData $remote_iov_addr, int $riovcnt, int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Bug Best Practice introduced by
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
    }
}
Loading history...
The parameter $local_iov_addr is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(int $pid, /** @scrutinizer ignore-unused */ CData $local_iov_addr, int $liovcnt, CData $remote_iov_addr, int $riovcnt, int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $riovcnt is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(int $pid, CData $local_iov_addr, int $liovcnt, CData $remote_iov_addr, /** @scrutinizer ignore-unused */ int $riovcnt, int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $liovcnt is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

37
    public function process_vm_readv(int $pid, CData $local_iov_addr, /** @scrutinizer ignore-unused */ int $liovcnt, CData $remote_iov_addr, int $riovcnt, int $flags): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
}
39
40
class errno_ffi extends \FFI
41
{
42
    /** @var int|CInteger */
43
    public int $errno;
44
}
45
46
class execvp_ffi extends \FFI
47
{
48
    public function execvp(string $file, CData $argv): int {}
0 ignored issues
show
Bug Best Practice introduced by
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
    }
}
Loading history...
The parameter $argv is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
    public function execvp(string $file, /** @scrutinizer ignore-unused */ CData $argv): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $file is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

48
    public function execvp(/** @scrutinizer ignore-unused */ string $file, CData $argv): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
49
}
50
51
class ptrace_ffi extends \FFI
52
{
53
    /**
54
     * @param int $request
55
     * @param int $pid
56
     * @param CData $addr
57
     * @param CData $data
58
     * @return int
59
     */
60
    public function ptrace(int $request, int $pid, CData $addr, CData $data): int {}
0 ignored issues
show
Bug Best Practice introduced by
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
    }
}
Loading history...
The parameter $addr is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function ptrace(int $request, int $pid, /** @scrutinizer ignore-unused */ CData $addr, CData $data): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $data is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function ptrace(int $request, int $pid, CData $addr, /** @scrutinizer ignore-unused */ CData $data): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $request is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function ptrace(/** @scrutinizer ignore-unused */ int $request, int $pid, CData $addr, CData $data): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $pid is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

60
    public function ptrace(int $request, /** @scrutinizer ignore-unused */ int $pid, CData $addr, CData $data): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
61
}
62
63
class libc_file_ffi extends \FFI
64
{
65
    public function open(string $path, int $mode): int {}
0 ignored issues
show
The parameter $mode is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

65
    public function open(string $path, /** @scrutinizer ignore-unused */ int $mode): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $path is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

65
    public function open(/** @scrutinizer ignore-unused */ string $path, int $mode): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Bug Best Practice introduced by
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
    }
}
Loading history...
66
    public function read(int $fd, CData $buffer, int $size): int {}
0 ignored issues
show
The parameter $fd is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

66
    public function read(/** @scrutinizer ignore-unused */ int $fd, CData $buffer, int $size): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $buffer is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

66
    public function read(int $fd, /** @scrutinizer ignore-unused */ CData $buffer, int $size): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $size is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

66
    public function read(int $fd, CData $buffer, /** @scrutinizer ignore-unused */ int $size): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Bug Best Practice introduced by
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
    }
}
Loading history...
67
    public function close(int $fd) {}
0 ignored issues
show
The parameter $fd is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

67
    public function close(/** @scrutinizer ignore-unused */ int $fd) {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
68
}