Skip to content

Commit f81d9da

Browse files
committed
fix: style code with phpstan
1 parent 71cd925 commit f81d9da

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Commands/ChangeOwnerConfigJson.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,19 @@ public function handle(): void
3131
{
3232
if (PHP_OS_FAMILY !== 'Linux') {
3333
$this->error('This command only works on Linux');
34-
3534
return;
3635
}
3736

38-
$user = $this->argument('user') ?? '';
39-
$group = $this->argument('group') ?? $user;
37+
$user = (string) ($this->argument('user') ?? '');
38+
$group = (string) ($this->argument('group') ?? $user);
4039

4140
if (empty($user) || empty($group)) {
42-
$group = $user = exec('ps aux | egrep "(apache|httpd|nginx)" | grep -v "root" | head -n1 | cut -d\ -f1');
41+
$group = $user = (string) exec('ps aux | egrep "(apache|httpd|nginx)" | grep -v "root" | head -n1 | cut -d\ -f1');
4342
}
4443

4544
$jsonsPath = config('telegram-git-notifier.data_file.storage_folder');
4645
if (is_string($jsonsPath) && file_exists($jsonsPath)) {
47-
shell_exec("chown -R $user:$group $jsonsPath");
46+
shell_exec("chown -R " . escapeshellarg($user) . ":" . escapeshellarg($group) . " " . escapeshellarg($jsonsPath));
4847
} else {
4948
$this->error('The path to the jsons folder is not valid');
5049
}

0 commit comments

Comments
 (0)