From d5098d10fdeb1eccf3a4c0bc15b241d111f046b6 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Sat, 9 Mar 2024 16:40:42 -0300 Subject: [PATCH] Fix psalm and phpcs issues Signed-off-by: Vitor Mattos --- composer.json | 2 +- psalm-baseline.xml | 8 ++++++++ psalm.xml | 1 + src/NextcloudApiContext.php | 5 ++--- 4 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 psalm-baseline.xml diff --git a/composer.json b/composer.json index fa94a93..fc0382b 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "psalm": "psalm --threads=1", - "psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml", + "psalm:update-baseline": "psalm --threads=1 --update-baseline --set-baseline=psalm-baseline.xml", "psalm:clear": "psalm --clear-cache && psalm --clear-global-cache", "post-install-cmd": [ "@composer bin all install --ansi", diff --git a/psalm-baseline.xml b/psalm-baseline.xml new file mode 100644 index 0000000..2a9059c --- /dev/null +++ b/psalm-baseline.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/psalm.xml b/psalm.xml index 01b01a1..2f70544 100644 --- a/psalm.xml +++ b/psalm.xml @@ -7,6 +7,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + errorBaseline="psalm-baseline.xml" > diff --git a/src/NextcloudApiContext.php b/src/NextcloudApiContext.php index cdbc94f..25309e4 100644 --- a/src/NextcloudApiContext.php +++ b/src/NextcloudApiContext.php @@ -273,9 +273,8 @@ public function theResponseShouldBeAJsonArrayWithTheFollowingMandatoryValues(Tab } } - private function validateAsJsonQuery(string $expected, $actual) { - $return = shell_exec('which jq'); - if (empty($return)) { + private function validateAsJsonQuery(string $expected, string $actual): void { + if (!`which jq`) { throw new \InvalidArgumentException('Is necessary install the jq command to use jq'); } $jq = \JsonQueryWrapper\JsonQueryFactory::createWith($actual);