mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
Add phpstan level 7(#544)
This commit is contained in:
@ -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 [
|
||||
|
Reference in New Issue
Block a user