Skip to content

fix(#71): align getClientStatus return type with getClusterStatus - #76

Merged
s2x merged 1 commit into
masterfrom
fix/issue-71-client-status-array
Jul 7, 2026
Merged

fix(#71): align getClientStatus return type with getClusterStatus#76
s2x merged 1 commit into
masterfrom
fix/issue-71-client-status-array

Conversation

@s2x

@s2x s2x commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #71

Database::getClientStatus() returned a raw JSON string while AdminClient::getClusterStatus() returned a parsed array, forcing callers to remember which method returns which format.

This adds an optional bool $asArray = false parameter to Database::getClientStatus(). When true, it returns the decoded status as array<string, mixed>, matching getClusterStatus(). The default (false) preserves the previous raw-JSON-string return type, so the change is fully backward-compatible.

Changes

  • src/Database.php: add optional $asArray param (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 lint passes (PHPCS + Rector dry-run + PHPStan).
  • composer test:unit passes (3 GMP-related failures are pre-existing, caused by the GMP extension not being loaded in this local environment; CI provides it).

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
s2x force-pushed the fix/issue-71-client-status-array branch from 175d3c3 to 6e14fce Compare July 7, 2026 16:14
@s2x
s2x merged commit 4d18dfb into master Jul 7, 2026
6 checks passed
@s2x
s2x deleted the fix/issue-71-client-status-array branch July 7, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Maintainability] Inconsistent return types between Database::getClientStatus() and AdminClient::getClusterStatus()

1 participant