100% type coverage for psalm
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Jens True 2023-07-28 12:12:47 +00:00
parent 14b2155595
commit 1d898e350b
6 changed files with 25 additions and 17 deletions

12
backup

@ -8,8 +8,12 @@ use Composer\InstalledVersions;
$package = \Composer\InstalledVersions::getRootPackage(); $package = \Composer\InstalledVersions::getRootPackage();
$application = new Application('backup', $package['version']); $application = new Application('backup', $package['version']);
try {
$application->add(new App\CommandBackup());
$application->add(new App\CommandShow());
$application->add(new App\CommandBackup()); $application->run();
$application->add(new App\CommandShow()); } catch(Exception $e)
{
$application->run(); echo("Critical error: ". $e->getMessage());
}

12
composer.lock generated

@ -3290,16 +3290,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "10.1.2", "version": "10.1.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e" "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/db1497ec8dd382e82c962f7abbe0320e4882ee4e", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/be1fe461fdc917de2a29a452ccf2657d325b443d",
"reference": "db1497ec8dd382e82c962f7abbe0320e4882ee4e", "reference": "be1fe461fdc917de2a29a452ccf2657d325b443d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3356,7 +3356,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.2" "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.3"
}, },
"funding": [ "funding": [
{ {
@ -3364,7 +3364,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-05-22T09:04:27+00:00" "time": "2023-07-26T13:45:28+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",

@ -7,12 +7,16 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true" findUnusedBaselineEntry="true"
findUnusedCode="true" findUnusedCode="true"
strictBinaryOperands="true"
checkForThrowsInGlobalScope="true"
ignoreInternalFunctionFalseReturn="false"
ignoreInternalFunctionNullReturn ="false"
findUnusedVariablesAndParams="true"
findUnusedPsalmSuppress="true"
restrictReturnTypes="true"
> >
<projectFiles> <projectFiles>
<directory name="src/" /> <directory name="src/" />
<file name="backup" /> <file name="backup" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles> </projectFiles>
</psalm> </psalm>

@ -81,7 +81,7 @@ class App
*/ */
public function getConfig(string $key): mixed public function getConfig(string $key): mixed
{ {
/** @var mixed */ /** @var string|array<string, string> */
$ret = $this->config->get($key); $ret = $this->config->get($key);
$this->logger->debug("Fetching configuration key", [$key, $ret]); $this->logger->debug("Fetching configuration key", [$key, $ret]);
return $ret; return $ret;

@ -14,7 +14,7 @@ use Exception;
* *
* Installation of rclone is required. * Installation of rclone is required.
* Configuration of the mounts must be done before use. * Configuration of the mounts must be done before use.
* Tested using rclone v1.53.3-DEV * Tested using rclone v1.62.2
*/ */
class Rclone class Rclone
{ {
@ -97,7 +97,7 @@ class Rclone
$options[] = $dest; $options[] = $dest;
foreach ($additionalOptions as $key => $value) { foreach ($additionalOptions as $key => $value) {
$options[] = '--' . $key; $options[] = '--' . (string)$key;
$options[] = $value; $options[] = $value;
} }

@ -48,7 +48,7 @@ final class RcloneTest extends TestCase
$this->expectException(\Exception::class); $this->expectException(\Exception::class);
$this->expectExceptionMessage("ERROR"); $this->expectExceptionMessage("ERROR");
$size = $rclone->getSize('temp/bogus-source'); $rclone->getSize('temp/bogus-source');
$this->fail('Exception was not thrown'); $this->fail('Exception was not thrown');
} }