-
Notifications
You must be signed in to change notification settings - Fork 10
Return empty modules array when module command is not available #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -128,7 +128,14 @@ public static function registerCommandsRediska(): void | |||||
|
||||||
public static function getRediSearchVersion(Client $client): ?string | ||||||
{ | ||||||
$modules = $client->executeRaw('module', 'list') ?? []; | ||||||
try { | ||||||
$modules = $client->executeRaw('module', 'list') ?? []; | ||||||
} catch (\Throwable $exception) { | ||||||
if (strpos($exception->getMessage(), 'unknown command') === false) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yoda style test is used (see PHP-CS-Fixer error: https://github.com/MacFJA/php-redisearch/runs/7054519075?check_suite_focus=true)
Suggested change
|
||||||
throw $exception; | ||||||
} | ||||||
$modules = []; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can return
Suggested change
|
||||||
} | ||||||
|
||||||
foreach ($modules as $module) { | ||||||
$data = array_column( | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\Throwable
should be imported (see PHP-CS-Fixer error: https://github.com/MacFJA/php-redisearch/runs/7054519075?check_suite_focus=true)