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

@ -29,7 +29,7 @@ public function deletionRules(): array
{
return [
'service' => [
function (string $attribute, mixed $value, Closure $fail) {
function (string $attribute, mixed $value, Closure $fail): void {
$hasSite = $this->service->server->sites()
->where('php_version', $this->service->version)
->exists();
@ -88,7 +88,7 @@ public function setDefaultCli(): void
/**
* @throws SSHError
*/
public function installExtension($name): void
public function installExtension(string $name): void
{
$result = $this->service->server->ssh()->exec(
view('ssh.services.php.install-php-extension', [
@ -97,7 +97,11 @@ public function installExtension($name): void
]),
'install-php-extension-'.$name
);
$result = Str::substr($result, strpos($result, '[PHP Modules]'));
$pos = strpos($result, '[PHP Modules]');
if ($pos === false) {
throw new SSHCommandError('Failed to install extension');
}
$result = Str::substr($result, $pos);
if (! Str::contains($result, $name)) {
throw new SSHCommandError('Failed to install extension');
}
@ -127,7 +131,7 @@ public function getPHPIni(string $type): string
/**
* @throws SSHError
*/
public function createFpmPool(string $user, string $version, $site_id): void
public function createFpmPool(string $user, string $version): void
{
$this->service->server->ssh()->write(
"/etc/php/{$version}/fpm/pool.d/{$user}.conf",
@ -144,7 +148,7 @@ public function createFpmPool(string $user, string $version, $site_id): void
/**
* @throws SSHError
*/
public function removeFpmPool(string $user, string $version, $site_id): void
public function removeFpmPool(string $user, string $version, ?int $siteId): void
{
$this->service->server->ssh()->exec(
view('ssh.services.php.remove-fpm-pool', [
@ -152,7 +156,7 @@ public function removeFpmPool(string $user, string $version, $site_id): void
'version' => $version,
]),
"remove-{$version}fpm-pool-{$user}",
$site_id
$siteId
);
}
}