bytic /
http
| 1 | <?php |
||||
| 2 | declare(strict_types=1); |
||||
| 3 | |||||
| 4 | namespace Nip\Http\Request\Traits; |
||||
| 5 | |||||
| 6 | /** |
||||
| 7 | * Class ArrayAccessTrait |
||||
| 8 | * @package Nip\Http\Request\Traits |
||||
| 9 | */ |
||||
| 10 | trait ArrayAccessTrait |
||||
| 11 | { |
||||
| 12 | /** |
||||
| 13 | * @param mixed $offset |
||||
| 14 | * @return bool |
||||
| 15 | 1 | */ |
|||
| 16 | public function offsetExists($offset): bool |
||||
| 17 | 1 | { |
|||
| 18 | return $this->has($offset); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * @param mixed $offset |
||||
| 23 | * @return mixed |
||||
| 24 | */ |
||||
| 25 | public function offsetGet($offset): mixed |
||||
| 26 | { |
||||
| 27 | return $this->get($offset); |
||||
|
0 ignored issues
–
show
It seems like
get() must be provided by classes using this trait. How about adding it as abstract method to this trait?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 28 | } |
||||
| 29 | |||||
| 30 | /** |
||||
| 31 | * @param mixed $offset |
||||
| 32 | * @param mixed $value |
||||
| 33 | */ |
||||
| 34 | public function offsetSet($offset, $value): void |
||||
| 35 | { |
||||
| 36 | $this->attributes->set($offset, $value); |
||||
|
0 ignored issues
–
show
The property
attributes does not exist on Nip\Http\Request\Traits\ArrayAccessTrait. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 37 | } |
||||
| 38 | |||||
| 39 | /** |
||||
| 40 | * @param mixed $offset |
||||
| 41 | */ |
||||
| 42 | public function offsetUnset($offset): void |
||||
| 43 | { |
||||
| 44 | $this->attributes->remove($offset); |
||||
|
0 ignored issues
–
show
The property
attributes does not exist on Nip\Http\Request\Traits\ArrayAccessTrait. Since you implemented __get, consider adding a @property annotation.
Loading history...
|
|||||
| 45 | } |
||||
| 46 | |||||
| 47 | /** |
||||
| 48 | * @param $name |
||||
| 49 | * @return mixed |
||||
| 50 | 1 | */ |
|||
| 51 | public function __get($name) |
||||
| 52 | 1 | { |
|||
| 53 | return $this->get($name); |
||||
| 54 | } |
||||
| 55 | } |
||||
| 56 |