Issues (105)

src/RouteCollections/Traits/ArrayAccessTrait.php (4 issues)

Labels
Severity
1
<?php
2
declare(strict_types=1);
3
4
namespace Nip\Router\RouteCollections\Traits;
5
6
use Nip\Router\Route\Route;
7
8
/**
9
 * Trait ArrayAccessTrait
10
 * @package Nip\Router\RouteCollections\Traits
11
 */
12
trait ArrayAccessTrait
13
{
14
    /**
15
     * @param mixed $offset
16
     * @return bool
17
     */
18
    public function offsetExists($offset): bool
19
    {
20
        return $this->has($offset);
0 ignored issues
show
It seems like has() 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 ignore-call  annotation

20
        return $this->/** @scrutinizer ignore-call */ has($offset);
Loading history...
21
    }
22
23
    /**
24
     * @param mixed $offset
25
     * @return Route|null
26 1
     */
27
    public function offsetGet($offset): mixed
28 1
    {
29
        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 ignore-call  annotation

29
        return $this->/** @scrutinizer ignore-call */ get($offset);
Loading history...
30
    }
31
32
    /**
33
     * @param mixed $offset
34
     * @param mixed $value
35
     */
36
    public function offsetSet($offset, $value): void
37
    {
38
        $this->add($offset, $value);
0 ignored issues
show
It seems like add() 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 ignore-call  annotation

38
        $this->/** @scrutinizer ignore-call */ 
39
               add($offset, $value);
Loading history...
39
    }
40
41
    /**
42
     * @param mixed $offset
43
     */
44
    public function offsetUnset($offset): void
45
    {
46
        $this->remove($offset);
0 ignored issues
show
It seems like remove() 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 ignore-call  annotation

46
        $this->/** @scrutinizer ignore-call */ 
47
               remove($offset);
Loading history...
47
    }
48
}
49