From 24979ca76edcd61cde6ffe7c0a741afedc8418f7 Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 21 Nov 2023 15:19:31 +0000 Subject: [PATCH 1/2] Add support for PHP 8.3 Also adds recommended settings for psalm and deals with a few minor issues Signed-off-by: George Steel --- composer.json | 6 +++--- composer.lock | 4 ++-- psalm-baseline.xml | 8 ++++---- psalm.xml | 4 ++++ src/AutoComposer.php | 6 ------ test/AutoComposerTest.php | 1 + 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index a0c6733..13a8249 100644 --- a/composer.json +++ b/composer.json @@ -24,14 +24,14 @@ } }, "require": { - "php": "~8.1.0 || ~8.2.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "require-dev": { "laminas/laminas-coding-standard": "~2.5.0", "mikey179/vfsstream": "^1.6.11", - "phpunit/phpunit": "^10.2.2", + "phpunit/phpunit": "^10.4.2", "psalm/plugin-phpunit": "^0.18.4", - "vimeo/psalm": "^5.13.1" + "vimeo/psalm": "^5.15.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index eb5d1d5..9d736bf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c441ac3435d26bdb29789c5d24f61310", + "content-hash": "51773f1a3f57c4dab1c71a87060a5e70", "packages": [], "packages-dev": [ { @@ -4009,7 +4009,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~8.1.0 || ~8.2.0" + "php": "~8.1.0 || ~8.2.0 || ~8.3.0" }, "platform-dev": [], "platform-overrides": { diff --git a/psalm-baseline.xml b/psalm-baseline.xml index ae4fada..b40544e 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,11 +1,14 @@ - + $argument + + applicationConfigPath]]> + removeConfigCacheFile @@ -20,9 +23,6 @@ projectDir)]]> - - applicationConfigPath]]> - diff --git a/psalm.xml b/psalm.xml index 62df690..db03cfd 100644 --- a/psalm.xml +++ b/psalm.xml @@ -5,9 +5,13 @@ xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" errorBaseline="psalm-baseline.xml" + findUnusedCode="true" + findUnusedBaselineEntry="true" + findUnusedPsalmSuppress="true" > + diff --git a/src/AutoComposer.php b/src/AutoComposer.php index 5473614..3f97516 100644 --- a/src/AutoComposer.php +++ b/src/AutoComposer.php @@ -34,12 +34,6 @@ class AutoComposer /** @var resource */ private $errorStream; - /** @var string[] */ - private array $expectedValues = [ - '0', // production mode - '1', // development mode - ]; - /** * @param string $projectDir Location to resolve project from. * @param null|resource $errorStream Stream to which to write errors; defaults to STDERR diff --git a/test/AutoComposerTest.php b/test/AutoComposerTest.php index 7d15475..c8ce6bb 100644 --- a/test/AutoComposerTest.php +++ b/test/AutoComposerTest.php @@ -19,6 +19,7 @@ class AutoComposerTest extends TestCase { use RemoveCacheFileTrait; + /** @psalm-suppress UnusedProperty */ private vfsStreamContainer $projectDir; /** @var resource */ From 50b6b541dcefa1219144404adb589f3847077175 Mon Sep 17 00:00:00 2001 From: George Steel Date: Tue, 21 Nov 2023 15:32:26 +0000 Subject: [PATCH 2/2] Add rudimentary test for the Command class Avoids psalm issues for UnusedClass. STDERR and STDOUT cannot easily be captured during a test. Signed-off-by: George Steel --- test/CommandTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/CommandTest.php diff --git a/test/CommandTest.php b/test/CommandTest.php new file mode 100644 index 0000000..43d14c9 --- /dev/null +++ b/test/CommandTest.php @@ -0,0 +1,24 @@ +