fix(#71): align getClientStatus return type with getClusterStatus - #76
Merged
Conversation
Add optional $asArray parameter to Database::getClientStatus() so it can return a parsed array consistent with AdminClient::getClusterStatus(). Default preserves backward-compatible raw JSON string.
s2x
force-pushed
the
fix/issue-71-client-status-array
branch
from
July 7, 2026 16:14
175d3c3 to
6e14fce
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #71
Database::getClientStatus()returned a raw JSON string whileAdminClient::getClusterStatus()returned a parsed array, forcing callers to remember which method returns which format.This adds an optional
bool $asArray = falseparameter toDatabase::getClientStatus(). Whentrue, it returns the decoded status asarray<string, mixed>, matchinggetClusterStatus(). The default (false) preserves the previous raw-JSON-string return type, so the change is fully backward-compatible.Changes
src/Database.php: add optional$asArrayparam (conditional return type via PHPStan generics).tests/Integration/DatabaseMonitoringTest.php: add test for the parsed-array form.tests/Integration/RebootWorkerTest.php: consume the array form directly.README.md,docs/advanced.md,CHANGELOG.md: document the new option.Verification
composer lintpasses (PHPCS + Rector dry-run + PHPStan).composer test:unitpasses (3 GMP-related failures are pre-existing, caused by the GMP extension not being loaded in this local environment; CI provides it).