More type deconfusion
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
10
composer.lock
generated
10
composer.lock
generated
@ -3228,16 +3228,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.10.22",
|
||||
"version": "1.10.24",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287"
|
||||
"reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/97d694dfd4ceb57bcce4e3b38548f13ea62e4287",
|
||||
"reference": "97d694dfd4ceb57bcce4e3b38548f13ea62e4287",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/360ecc90569e9a60c2954ee209ec04fa0d958e14",
|
||||
"reference": "360ecc90569e9a60c2954ee209ec04fa0d958e14",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -3286,7 +3286,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-06-30T20:04:11+00:00"
|
||||
"time": "2023-07-05T12:32:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
@ -58,6 +58,7 @@ class App
|
||||
]);
|
||||
|
||||
$parser = new Yaml();
|
||||
/** @var array<string, mixed> */
|
||||
$parsedConfig = $parser->parseFile($configFile);
|
||||
|
||||
|
||||
@ -66,7 +67,7 @@ class App
|
||||
|
||||
$logger = new Logger('app');
|
||||
if ($this->config->get('log')) {
|
||||
$logger->pushHandler(new StreamHandler($this->config->get('log')));
|
||||
$logger->pushHandler(new StreamHandler((string)$this->config->get('log')));
|
||||
$logger->info("Logging enabled");
|
||||
}
|
||||
$logger->info("Initialization complete");
|
||||
@ -82,8 +83,9 @@ class App
|
||||
*/
|
||||
public function getConfig(string $key): mixed
|
||||
{
|
||||
/** @var mixed */
|
||||
$ret = $this->config->get($key);
|
||||
$this->logger->debug("Fetching configuration key", [$key,$ret]);
|
||||
$this->logger->debug("Fetching configuration key", [$key, $ret]);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ class CommandBackup extends Command
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
$rclone = new Rclone($app->getConfig('rclone.path'));
|
||||
$rclone = new Rclone((string)$app->getConfig('rclone.path'));
|
||||
$rclone->setLogger($app->getLogger()->withName('rclone'));
|
||||
|
||||
$notification = new Notification();
|
||||
@ -48,19 +48,22 @@ class CommandBackup extends Command
|
||||
|
||||
$render = new Twig($app->getConfig('templates'));
|
||||
|
||||
/** @var array{title: string, source: string, destination: string} $conf */
|
||||
foreach ($sio->progressIterate($app->getConfig('backup')) as $conf) {
|
||||
$title = $conf['title'];
|
||||
try {
|
||||
$template = array();
|
||||
$template['config'] = $conf;
|
||||
$template['start'] = new DateTime();
|
||||
$template['source_size'] = $rclone->getSize((string)$conf['source']);
|
||||
$template['source_size'] = $rclone->getSize($conf['source']);
|
||||
$template['rclone_version'] = $rclone->getVersion();
|
||||
$template['destination_size_before'] = $rclone->getSize((string)$conf['destination']);
|
||||
$template['destination_size_before'] = $rclone->getSize($conf['destination']);
|
||||
|
||||
$rclone->copy((string)$conf['source'], (string)$conf['destination'], $app->getConfig('rclone.options'));
|
||||
/** @var array<array-key, string> */
|
||||
$rcloneOptions = $app->getConfig('rclone.options');
|
||||
$rclone->copy($conf['source'], $conf['destination'], $rcloneOptions);
|
||||
|
||||
$template['destination_size_after'] = $rclone->getSize((string)$conf['destination']);
|
||||
$template['destination_size_after'] = $rclone->getSize($conf['destination']);
|
||||
$template['end'] = new DateTime();
|
||||
|
||||
$message = $render->render('notify', $template);
|
||||
@ -68,7 +71,7 @@ class CommandBackup extends Command
|
||||
$message = $e->getMessage();
|
||||
}
|
||||
|
||||
$notification->send((string)$title, $message);
|
||||
$notification->send($title, $message);
|
||||
}
|
||||
|
||||
$sio->success("Complete");
|
||||
|
@ -35,10 +35,11 @@ class CommandShow extends Command
|
||||
$sio->error('Configuration error: ' . $e->getMessage());
|
||||
return Command::FAILURE;
|
||||
}
|
||||
|
||||
/** @var array{title: string, source: string, destination: string}[] */
|
||||
$backupElements = $app->getConfig('backup');
|
||||
$sio->table(
|
||||
['Description', 'Source', 'Destination'],
|
||||
$app->getConfig('backup')
|
||||
$backupElements
|
||||
);
|
||||
|
||||
$sio->success("Done");
|
||||
|
Reference in New Issue
Block a user