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.
This commit is contained in:
1 parent
c929fdfda6
commit
78e7a72ee9
2 files changed
+8
-4
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user