Issues (43)

src/Lazy/Traits/CheckLoadedFunctionsTrait.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Nip\Collections\Lazy\Traits;
4
5
use Nip\Collections\CollectionInterface;
6
7
/**
8
 * Trait CheckLoadedFunctionsTrait
9
 * @package Nip\Collections\Lazy\Traits
10
 * @internal
11
 */
12
trait CheckLoadedFunctionsTrait
13
{
14
    /**
15 1
     * @inheritDoc
16
     */
17 1
    public function offsetSet($key, $value)
18 1
    {
19
        $this->load();
0 ignored issues
show
It seems like load() 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

19
        $this->/** @scrutinizer ignore-call */ 
20
               load();
Loading history...
20
        parent::offsetSet($key, $value);
21
    }
22
23
    /**
24
     * @inheritDoc
25
     */
26
    public function offsetGet($key)
27
    {
28
        $this->load();
29
        return parent::offsetGet($key);
30
    }
31
32
    /**
33
     * @inheritDoc
34
     */
35
    public function offsetExists($key)
36
    {
37
        $this->load();
38
        return parent::offsetExists($key);
39
    }
40
41
    /**
42
     * @inheritDoc
43
     */
44
    public function offsetUnset($key)
45
    {
46
        $this->load();
47
        parent::offsetUnset($key);
48
    }
49
50
    /**
51
     * @inheritDoc
52
     */
53
    public function filter(callable $callback = null): CollectionInterface
54
    {
55
        $this->load();
56
        return parent::filter($callback);
57
    }
58
59
60
    /**
61 2
     * @inheritDoc
62
     */
63 2
    public function count()
64 2
    {
65
        $this->load();
66
        return parent::count();
67
    }
68
}
69