Add phpstan level 7(#544)

This commit is contained in:
Saeed Vaziry
2025-03-12 13:31:10 +01:00
committed by GitHub
parent c22bb1fa80
commit 493cbb0849
437 changed files with 4505 additions and 2193 deletions

View File

@ -41,9 +41,9 @@ public function connect(): bool
/**
* @throws Exception
*/
public function getRepo(?string $repo = null): mixed
public function getRepo(string $repo): mixed
{
$repository = $repo ? urlencode($repo) : null;
$repository = $repo !== '' && $repo !== '0' ? urlencode($repo) : null;
$res = Http::withToken($this->data()['token'])
->get($this->getApiUrl().'/projects/'.$repository.'/repository/commits');
@ -54,7 +54,7 @@ public function getRepo(?string $repo = null): mixed
public function fullRepoUrl(string $repo, string $key): string
{
$host = parse_url($this->getApiUrl())['host'];
$host = parse_url($this->getApiUrl())['host'] ?? 'gitlab.com';
return sprintf('git@%s-%s:%s.git', $host, $key, $repo);
}
@ -170,9 +170,7 @@ public function deployKey(string $title, string $repo, string $key): void
public function getApiUrl(): string
{
$host = $this->sourceControl->url === null
? $this->defaultApiHost
: $this->sourceControl->url;
$host = $this->sourceControl->url ?? $this->defaultApiHost;
return $host.$this->apiVersion;
}