refactor(astrolabe): add PHP property types to fix Psalm errors

Add explicit property type declarations to IdpTokenRefresher,
CredentialsController, OAuthController, and McpServerClient classes.
This improves type safety and allows Psalm to properly infer types,
eliminating MissingPropertyType and many MixedMethodCall errors.

Also adds IClient import where needed and validates getSystemValue
returns to ensure string types before use.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-01-17 21:24:56 +01:00
co-authored by Claude Opus 4.5
parent 737f10f190
commit f0ade4ad28
5 changed files with 71 additions and 326 deletions
+7 -5
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace OCA\Astrolabe\Service;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\IConfig;
use Psr\Log\LoggerInterface;
@@ -16,10 +17,10 @@ use Psr\Log\LoggerInterface;
* for all management operations.
*/
class McpServerClient {
private $httpClient;
private $config;
private $logger;
private $baseUrl;
private IClient $httpClient;
private IConfig $config;
private LoggerInterface $logger;
private string $baseUrl;
public function __construct(
IClientService $clientService,
@@ -31,7 +32,8 @@ class McpServerClient {
$this->logger = $logger;
// Get MCP server configuration from Nextcloud config
$this->baseUrl = $this->config->getSystemValue('mcp_server_url', 'http://localhost:8000');
$baseUrl = $this->config->getSystemValue('mcp_server_url', 'http://localhost:8000');
$this->baseUrl = is_string($baseUrl) ? $baseUrl : 'http://localhost:8000';
}
/**