| 1 | <?php |
||
| 10 | class CompositeArrayAccess implements \ArrayAccess |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | private $arrays; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @param array $arrays |
||
| 19 | */ |
||
| 20 | public function __construct(array $arrays) |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param $offset |
||
| 27 | */ |
||
| 28 | public function offsetExists($offset) |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @param $offset |
||
| 35 | */ |
||
| 36 | public function offsetGet($offset) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param $offset |
||
| 48 | * @param $value |
||
| 49 | */ |
||
| 50 | public function offsetSet($offset, $value) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @param $offset |
||
| 57 | */ |
||
| 58 | public function offsetUnset($offset) |
||
| 62 | } |
||
| 63 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: