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

@ -10,6 +10,9 @@
class ExecuteCommand
{
/**
* @param array<string, mixed> $input
*/
public function execute(Command $command, User $user, array $input): CommandExecution
{
$execution = new CommandExecution([
@ -21,22 +24,22 @@ public function execute(Command $command, User $user, array $input): CommandExec
]);
$execution->save();
dispatch(function () use ($execution, $command) {
dispatch(function () use ($execution, $command): void {
$content = $execution->getContent();
$log = ServerLog::make($execution->server, 'command-'.$command->id.'-'.strtotime('now'));
$log = ServerLog::newLog($execution->server, 'command-'.$command->id.'-'.strtotime('now'));
$log->save();
$execution->server_log_id = $log->id;
$execution->save();
$execution->server->os()->runScript(
path: $command->site->path,
script: $content,
user: $command->site->user,
serverLog: $log,
user: $command->site->user,
variables: $execution->variables
);
$execution->status = CommandExecutionStatus::COMPLETED;
$execution->save();
})->catch(function () use ($execution) {
})->catch(function () use ($execution): void {
$execution->status = CommandExecutionStatus::FAILED;
$execution->save();
})->onConnection('ssh');
@ -44,6 +47,10 @@ public function execute(Command $command, User $user, array $input): CommandExec
return $execution;
}
/**
* @param array<string, mixed> $input
* @return array<string, string|array<int, mixed>>
*/
public static function rules(array $input): array
{
return [