File tree 3 files changed +17
-7
lines changed
3 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
7
7
## [ Unreleased v2.x]
8
8
9
+ ### Fixed
10
+
11
+ - Allow Phpredis raw command to have 0 arguments ([ Issue #39 ] )
12
+
9
13
### Changed
10
14
11
15
- (dev) Update version and rules of PHP-CS-Fixer and PHPStan
@@ -196,6 +200,7 @@ First version
196
200
[ Issue#12 ] : https://github.com/MacFJA/php-redisearch/issues/12
197
201
[ Issue#16 ] : https://github.com/MacFJA/php-redisearch/issues/16
198
202
[ Issue#26 ] : https://github.com/MacFJA/php-redisearch/issues/26
203
+ [ Issue#39 ] : https://github.com/MacFJA/php-redisearch/issues/39
199
204
[ PR#1 ] : https://github.com/MacFJA/php-redisearch/pull/1
200
205
[ PR#3 ] : https://github.com/MacFJA/php-redisearch/pull/3
201
206
[ PR#8 ] : https://github.com/MacFJA/php-redisearch/pull/8
Original file line number Diff line number Diff line change 21
21
22
22
namespace MacFJA \RediSearch \Redis \Client ;
23
23
24
+ use Amp \Promise ;
24
25
use function Amp \Promise \wait ;
25
26
use Amp \Redis \Redis ;
26
27
use function function_exists ;
@@ -50,14 +51,19 @@ public static function make($redis): Client
50
51
51
52
public function execute (Command $ command )
52
53
{
53
- $ result = wait ($ this ->redis ->query ($ command ->getId (), ...array_map ('strval ' , $ command ->getArguments ())));
54
+ /** @var Promise<mixed> $query */
55
+ $ query = $ this ->redis ->query ($ command ->getId (), ...array_map ('strval ' , $ command ->getArguments ()));
56
+ $ result = wait ($ query );
54
57
55
58
return $ command ->parseResponse ($ result );
56
59
}
57
60
58
61
public function executeRaw (...$ args )
59
62
{
60
- return wait ($ this ->redis ->query (...array_map ('strval ' , $ args )));
63
+ /** @var Promise<mixed> $query */
64
+ $ query = $ this ->redis ->query (...array_map ('strval ' , $ args ));
65
+
66
+ return wait ($ query );
61
67
}
62
68
63
69
public static function supports ($ redis ): bool
Original file line number Diff line number Diff line change @@ -49,9 +49,11 @@ public function execute(Command $command)
49
49
{
50
50
$ arguments = $ command ->getArguments ();
51
51
if (0 === count ($ arguments )) {
52
- $ arguments = [null ];
52
+ /** @psalm-suppress TooFewArguments */
53
+ $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId ());
54
+ } else {
55
+ $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId (), ...$ arguments );
53
56
}
54
- $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId (), ...$ arguments );
55
57
56
58
return $ command ->parseResponse ($ rawResponse );
57
59
}
@@ -74,9 +76,6 @@ public function executeRaw(...$args)
74
76
if (count ($ args ) < 1 ) {
75
77
return null ;
76
78
}
77
- if (count ($ args ) < 2 ) {
78
- $ args [] = null ;
79
- }
80
79
// @phpstan-ignore-next-line
81
80
return $ this ->redis ->rawCommand (...$ args );
82
81
}
You can’t perform that action at this time.
0 commit comments