Issues (15)

src/ReJSON/ReJSON.php (13 issues)

1
<?php
2
declare(strict_types=1);
3
4
namespace Redislabs\Module\ReJSON;
5
6
use Redislabs\Interfaces\ModuleInterface;
7
use Redislabs\Module\ModuleTrait;
8
use Redislabs\Module\ReJSON\Command\Delete;
9
use Redislabs\Module\ReJSON\Command\Get;
10
use Redislabs\Module\ReJSON\Command\Set;
11
use Redislabs\Module\ReJSON\Command\MultipleGet;
12
use Redislabs\Module\ReJSON\Command\Type;
13
use Redislabs\Module\ReJSON\Command\NumberIncrementBy;
14
use Redislabs\Module\ReJSON\Command\NumberMultiplyBy;
15
use Redislabs\Module\ReJSON\Command\StringAppend;
16
use Redislabs\Module\ReJSON\Command\StringLength;
17
use Redislabs\Module\ReJSON\Command\ArrayAppend;
18
use Redislabs\Module\ReJSON\Command\ArrayIndex;
19
use Redislabs\Module\ReJSON\Command\ArrayInsert;
20
use Redislabs\Module\ReJSON\Command\ArrayLength;
21
use Redislabs\Module\ReJSON\Command\ArrayPop;
22
use Redislabs\Module\ReJSON\Command\ArrayTrim;
23
use Redislabs\Module\ReJSON\Command\ObjectKeys;
24
use Redislabs\Module\ReJSON\Command\ObjectLength;
25
use Redislabs\Module\ReJSON\Command\Debug;
26
use Redislabs\Module\ReJSON\Command\Forget;
0 ignored issues
show
The type Redislabs\Module\ReJSON\Command\Forget was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
use Redislabs\Module\ReJSON\Command\Resp;
28
29
class ReJSON implements ModuleInterface
30
{
31
    use ModuleTrait;
32
    protected static $moduleName = 'ReJSON';
33
34
    public function del(string $key, ?string $path = '.') : int
35
    {
36
        return $this->runCommand(
37
            Delete::createCommandWithArguments($key, $path)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

37
            Delete::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path)
Loading history...
38
        );
39
    }
40
41
    public function forget(string $key, ?string $path = '.') : int
42
    {
43
        return $this->del($key, $path);
44
    }
45
46
    public function set(string $key, string $path, $json, ?string $existentialModifier = null)
47
    {
48
        return $this->runCommand(
49
            Set::createCommandWithArguments($key, $path, $json, $existentialModifier)
50
        );
51
    }
52
53
    public function get(string $key, $paths = null)
54
    {
55
        return $this->runCommand(
56
            Get::createCommandWithArguments($key, $paths)
57
        );
58
    }
59
60
    public function mget(...$arguments)
61
    {
62
        return $this->runCommand(
63
            MultipleGet::createCommandWithArguments($arguments)
64
        );
65
    }
66
67
    public function type(string $key, ?string $paths = '.')
68
    {
69
        return $this->runCommand(
70
            Type::createCommandWithArguments($key, $paths)
71
        );
72
    }
73
74
    public function numincrby(string $key, string $path, int $incrementBy)
75
    {
76
        return $this->runCommand(
77
            NumberIncrementBy::createCommandWithArguments($key, $path, $incrementBy)
78
        );
79
    }
80
81
    public function nummultby(string $key, string $path, int $multiplyBy)
82
    {
83
        return $this->runCommand(
84
            NumberMultiplyBy::createCommandWithArguments($key, $path, $multiplyBy)
85
        );
86
    }
87
88
    public function strappend(string $key, $json, ?string $path = '.')
89
    {
90
        return $this->runCommand(
91
            StringAppend::createCommandWithArguments($key, $path, $json)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

91
            StringAppend::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path, $json)
Loading history...
92
        );
93
    }
94
95
    public function strlen(string $key, ?string $path = '.')
96
    {
97
        return $this->runCommand(
98
            StringLength::createCommandWithArguments($key, $path)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

98
            StringLength::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path)
Loading history...
99
        );
100
    }
101
102
    public function arrappend(string $key, string $path, ...$jsons)
103
    {
104
        return $this->runCommand(
105
            ArrayAppend::createCommandWithArguments($key, $path, $jsons)
106
        );
107
    }
108
109
    public function arrindex(string $key, string $path, $json, ?int $start = 0, ?int $stop = 0)
110
    {
111
        return $this->runCommand(
112
            ArrayIndex::createCommandWithArguments($key, $path, $json, $start, $stop)
0 ignored issues
show
It seems like $start can also be of type null; however, parameter $start of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

112
            ArrayIndex::createCommandWithArguments($key, $path, $json, /** @scrutinizer ignore-type */ $start, $stop)
Loading history...
It seems like $stop can also be of type null; however, parameter $stop of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

112
            ArrayIndex::createCommandWithArguments($key, $path, $json, $start, /** @scrutinizer ignore-type */ $stop)
Loading history...
113
        );
114
    }
115
116
    public function arrinsert(string $key, string $path, int $index, ...$jsons)
117
    {
118
        return $this->runCommand(
119
            ArrayInsert::createCommandWithArguments($key, $path, $index, $jsons)
120
        );
121
    }
122
123
    public function arrlen(string $key, string $path = '.')
124
    {
125
        return $this->runCommand(
126
            ArrayLength::createCommandWithArguments($key, $path)
127
        );
128
    }
129
130
    public function arrpop(string $key, ?string $path = '.', ?int $index = -1)
131
    {
132
        return $this->runCommand(
133
            ArrayPop::createCommandWithArguments($key, $path, $index)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

133
            ArrayPop::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path, $index)
Loading history...
It seems like $index can also be of type null; however, parameter $index of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

133
            ArrayPop::createCommandWithArguments($key, $path, /** @scrutinizer ignore-type */ $index)
Loading history...
134
        );
135
    }
136
137
    public function arrtrim(string $key, $path, ?int $start = 0, ?int $stop = 0)
138
    {
139
        return $this->runCommand(
140
            ArrayTrim::createCommandWithArguments($key, $path, $start, $stop)
0 ignored issues
show
It seems like $stop can also be of type null; however, parameter $stop of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

140
            ArrayTrim::createCommandWithArguments($key, $path, $start, /** @scrutinizer ignore-type */ $stop)
Loading history...
It seems like $start can also be of type null; however, parameter $start of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept integer, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

140
            ArrayTrim::createCommandWithArguments($key, $path, /** @scrutinizer ignore-type */ $start, $stop)
Loading history...
141
        );
142
    }
143
144
    public function objkeys(string $key, ?string $path = '.')
145
    {
146
        return $this->runCommand(
147
            ObjectKeys::createCommandWithArguments($key, $path)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

147
            ObjectKeys::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path)
Loading history...
148
        );
149
    }
150
151
    public function objlen(string $key, ?string $path = '.')
152
    {
153
        return $this->runCommand(
154
            ObjectLength::createCommandWithArguments($key, $path)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

154
            ObjectLength::createCommandWithArguments($key, /** @scrutinizer ignore-type */ $path)
Loading history...
155
        );
156
    }
157
158
    public function debug(string $subcommand, ?string $key = null, ?string $path = '.')
159
    {
160
        return $this->runCommand(
161
            Debug::createCommandWithArguments($subcommand, $key, $path)
0 ignored issues
show
It seems like $path can also be of type null; however, parameter $path of Redislabs\Module\ReJSON\...eCommandWithArguments() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

161
            Debug::createCommandWithArguments($subcommand, $key, /** @scrutinizer ignore-type */ $path)
Loading history...
162
        );
163
    }
164
165
    public function resp(string $key, ?string $paths = '.')
166
    {
167
        return $this->runCommand(
168
            Resp::createCommandWithArguments($key, $paths)
169
        );
170
    }
171
}
172