fix(astrolabe): resolve Psalm type errors in PDF preview code

Fix Psalm static analysis errors:
- Add return type annotations to refresh callback closures
- Use strict null comparisons instead of truthy/falsy checks
- Cast response body to string for json_decode
- Add type annotation for decoded JSON data
- Update psalm-baseline.xml to remove fixed issues

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-01-26 20:19:23 +01:00
co-authored by Claude Opus 4.5
parent d5544a7731
commit c09ebe99cc
3 changed files with 26 additions and 36 deletions
+2 -1
View File
@@ -646,7 +646,8 @@ class McpServerClient {
]
]
);
$data = json_decode($response->getBody(), true);
/** @var array{success?: bool, image?: string, page_number?: int, total_pages?: int, error?: string} $data */
$data = json_decode((string)$response->getBody(), true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new \RuntimeException('Invalid JSON response from server');