File tree Expand file tree Collapse file tree 3 files changed +17
-7
lines changed Expand file tree Collapse file tree 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
66
77## [ Unreleased v2.x]
88
9+ ### Fixed
10+
11+ - Allow Phpredis raw command to have 0 arguments ([ Issue #39 ] )
12+
913### Changed
1014
1115- (dev) Update version and rules of PHP-CS-Fixer and PHPStan
@@ -196,6 +200,7 @@ First version
196200[ Issue#12 ] : https://github.com/MacFJA/php-redisearch/issues/12
197201[ Issue#16 ] : https://github.com/MacFJA/php-redisearch/issues/16
198202[ Issue#26 ] : https://github.com/MacFJA/php-redisearch/issues/26
203+ [ Issue#39 ] : https://github.com/MacFJA/php-redisearch/issues/39
199204[ PR#1 ] : https://github.com/MacFJA/php-redisearch/pull/1
200205[ PR#3 ] : https://github.com/MacFJA/php-redisearch/pull/3
201206[ PR#8 ] : https://github.com/MacFJA/php-redisearch/pull/8
Original file line number Diff line number Diff line change 2121
2222namespace MacFJA \RediSearch \Redis \Client ;
2323
24+ use Amp \Promise ;
2425use function Amp \Promise \wait ;
2526use Amp \Redis \Redis ;
2627use function function_exists ;
@@ -50,14 +51,19 @@ public static function make($redis): Client
5051
5152 public function execute (Command $ command )
5253 {
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 );
5457
5558 return $ command ->parseResponse ($ result );
5659 }
5760
5861 public function executeRaw (...$ args )
5962 {
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 );
6167 }
6268
6369 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)
4949 {
5050 $ arguments = $ command ->getArguments ();
5151 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 );
5356 }
54- $ rawResponse = $ this ->redis ->rawCommand ($ command ->getId (), ...$ arguments );
5557
5658 return $ command ->parseResponse ($ rawResponse );
5759 }
@@ -74,9 +76,6 @@ public function executeRaw(...$args)
7476 if (count ($ args ) < 1 ) {
7577 return null ;
7678 }
77- if (count ($ args ) < 2 ) {
78- $ args [] = null ;
79- }
8079 // @phpstan-ignore-next-line
8180 return $ this ->redis ->rawCommand (...$ args );
8281 }
You can’t perform that action at this time.
0 commit comments