1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the sj-i/typed-cdata 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 FFI; |
15
|
|
|
|
16
|
|
|
class CData |
17
|
|
|
{ |
18
|
|
|
|
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @implements \ArrayAccess<int, CData> |
23
|
|
|
*/ |
24
|
|
|
class CDataArray extends CData implements \ArrayAccess |
25
|
|
|
{ |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Whether a offset exists |
29
|
|
|
* @link https://php.net/manual/en/arrayaccess.offsetexists.php |
30
|
|
|
* @param mixed $offset <p> |
31
|
|
|
* An offset to check for. |
32
|
|
|
* </p> |
33
|
|
|
* @return bool true on success or false on failure. |
34
|
|
|
* </p> |
35
|
|
|
* <p> |
36
|
|
|
* The return value will be casted to boolean if non-boolean was returned. |
37
|
|
|
*/ |
38
|
|
|
public function offsetExists($offset) |
39
|
|
|
{ |
40
|
|
|
// TODO: Implement offsetExists() method. |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param int $offset |
45
|
|
|
*/ |
46
|
|
|
public function offsetGet($offset): CData |
47
|
|
|
{ |
48
|
|
|
// TODO: Implement offsetGet() method. |
49
|
|
|
} |
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Offset to set |
53
|
|
|
* @link https://php.net/manual/en/arrayaccess.offsetset.php |
54
|
|
|
* @param mixed $offset <p> |
55
|
|
|
* The offset to assign the value to. |
56
|
|
|
* </p> |
57
|
|
|
* @param mixed $value <p> |
58
|
|
|
* The value to set. |
59
|
|
|
* </p> |
60
|
|
|
* @return void |
61
|
|
|
*/ |
62
|
|
|
public function offsetSet($offset, $value) |
63
|
|
|
{ |
64
|
|
|
// TODO: Implement offsetSet() method. |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Offset to unset |
69
|
|
|
* @link https://php.net/manual/en/arrayaccess.offsetunset.php |
70
|
|
|
* @param mixed $offset <p> |
71
|
|
|
* The offset to unset. |
72
|
|
|
* </p> |
73
|
|
|
* @return void |
74
|
|
|
*/ |
75
|
|
|
public function offsetUnset($offset) |
76
|
|
|
{ |
77
|
|
|
// TODO: Implement offsetUnset() method. |
78
|
|
|
} |
79
|
|
|
} |
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: