From 78e7a72ee989b853fe6c3d797dff7b7d9f2dfbf4 Mon Sep 17 00:00:00 2001 From: Haylan Date: Sat, 11 Jul 2026 16:46:04 +0200 Subject: [PATCH] fix(provider): normalize baseUrl before assigning readonly property Promoted readonly properties can't be reassigned in the constructor body, so GitLabProvider and GiteaProvider threw on every instantiation. Normalize the plain parameter first, then assign to a separately declared readonly property. --- src/Service/Provider/GitLabProvider.php | 6 ++++-- src/Service/Provider/GiteaProvider.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Service/Provider/GitLabProvider.php b/src/Service/Provider/GitLabProvider.php index 4dc1ade..26041dd 100644 --- a/src/Service/Provider/GitLabProvider.php +++ b/src/Service/Provider/GitLabProvider.php @@ -19,14 +19,16 @@ final class GitLabProvider implements ProviderInterface { use ProbeTrait; + private readonly string $baseUrl; + public function __construct( private readonly HttpClientInterface $client, private readonly string $username, private readonly string $token, private readonly LoggerInterface $logger, - private readonly string $baseUrl = '', + string $baseUrl = '', ) { - $this->baseUrl = rtrim($this->baseUrl !== '' ? $this->baseUrl : 'https://gitlab.com', '/'); + $this->baseUrl = rtrim($baseUrl !== '' ? $baseUrl : 'https://gitlab.com', '/'); } public function getName(): string diff --git a/src/Service/Provider/GiteaProvider.php b/src/Service/Provider/GiteaProvider.php index 5183c25..3448c03 100644 --- a/src/Service/Provider/GiteaProvider.php +++ b/src/Service/Provider/GiteaProvider.php @@ -20,14 +20,16 @@ final class GiteaProvider implements ProviderInterface { use ProbeTrait; + private readonly string $baseUrl; + public function __construct( private readonly HttpClientInterface $client, private readonly string $username, private readonly string $token, - private readonly string $baseUrl, + string $baseUrl, private readonly LoggerInterface $logger, ) { - $this->baseUrl = rtrim($this->baseUrl, '/'); + $this->baseUrl = rtrim($baseUrl, '/'); } public function getName(): string