From 0ffe2e2b93abdc37e14e7118dae086958f00e9c8 Mon Sep 17 00:00:00 2001 From: woutersioen Date: Tue, 26 Mar 2024 14:02:33 +0100 Subject: [PATCH 1/3] Run tests on PHP8.3 as well --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a63f30..cb7a803 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php: [ '8.1', '8.2' ] + php: [ '8.1', '8.2', '8.3' ] prefer-lowest: [ '', '--prefer-lowest' ] steps: - uses: actions/checkout@master From 3087074156bd6cf8ae6ee8cdebb0c367492c2d76 Mon Sep 17 00:00:00 2001 From: woutersioen Date: Tue, 26 Mar 2024 14:04:20 +0100 Subject: [PATCH 2/3] Override base type to not include `null` Because the defaultName is documented in the base class as string|null, psalm is not happy, because we're calling the parent constructor with a potential null value. Since we're always setting this to a string, we can safely avoid this though. --- src/Commands/CheckLicenses.php | 1 + src/Commands/CountUsedLicenses.php | 1 + src/Commands/GenerateConfig.php | 1 + src/Commands/ListAllowedLicenses.php | 1 + src/Commands/ListUsedLicenses.php | 1 + 5 files changed, 5 insertions(+) diff --git a/src/Commands/CheckLicenses.php b/src/Commands/CheckLicenses.php index 7ca34dd..462dfed 100644 --- a/src/Commands/CheckLicenses.php +++ b/src/Commands/CheckLicenses.php @@ -19,6 +19,7 @@ class CheckLicenses extends Command { + /** @var string */ protected static $defaultName = 'check'; public function __construct( diff --git a/src/Commands/CountUsedLicenses.php b/src/Commands/CountUsedLicenses.php index bbe16e0..888c399 100644 --- a/src/Commands/CountUsedLicenses.php +++ b/src/Commands/CountUsedLicenses.php @@ -14,6 +14,7 @@ class CountUsedLicenses extends Command { + /** @var string */ protected static $defaultName = 'count'; public function __construct( diff --git a/src/Commands/GenerateConfig.php b/src/Commands/GenerateConfig.php index 1925f65..168faba 100644 --- a/src/Commands/GenerateConfig.php +++ b/src/Commands/GenerateConfig.php @@ -16,6 +16,7 @@ class GenerateConfig extends Command { + /** @var string */ protected static $defaultName = 'generate-config'; public function __construct( diff --git a/src/Commands/ListAllowedLicenses.php b/src/Commands/ListAllowedLicenses.php index cc67009..c217f0b 100644 --- a/src/Commands/ListAllowedLicenses.php +++ b/src/Commands/ListAllowedLicenses.php @@ -13,6 +13,7 @@ class ListAllowedLicenses extends Command { + /** @var string */ protected static $defaultName = 'allowed'; public function __construct( diff --git a/src/Commands/ListUsedLicenses.php b/src/Commands/ListUsedLicenses.php index 28a68f3..3f45398 100644 --- a/src/Commands/ListUsedLicenses.php +++ b/src/Commands/ListUsedLicenses.php @@ -14,6 +14,7 @@ class ListUsedLicenses extends Command { + /** @var string */ protected static $defaultName = 'used'; public function __construct( From ff3415e3c3fc04cca833ca1cf12dd1473d7d4347 Mon Sep 17 00:00:00 2001 From: woutersioen Date: Tue, 26 Mar 2024 14:06:40 +0100 Subject: [PATCH 3/3] Make psalm happy by casting to string This is always a string, but because the parent class says it's `null|string`, we cannot just override the type here (this gives another error: NonInvariantDocblockPropertyType). Casting to a string is safe though since we know it's always a string anyway. --- src/Commands/CheckLicenses.php | 3 +-- src/Commands/CountUsedLicenses.php | 3 +-- src/Commands/GenerateConfig.php | 3 +-- src/Commands/ListAllowedLicenses.php | 3 +-- src/Commands/ListUsedLicenses.php | 3 +-- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Commands/CheckLicenses.php b/src/Commands/CheckLicenses.php index 462dfed..9811331 100644 --- a/src/Commands/CheckLicenses.php +++ b/src/Commands/CheckLicenses.php @@ -19,7 +19,6 @@ class CheckLicenses extends Command { - /** @var string */ protected static $defaultName = 'check'; public function __construct( @@ -28,7 +27,7 @@ public function __construct( private readonly DependencyTree $dependencyTree, private readonly TableRenderer $tableRenderer ) { - parent::__construct(self::$defaultName); + parent::__construct((string) self::$defaultName); } protected function configure(): void diff --git a/src/Commands/CountUsedLicenses.php b/src/Commands/CountUsedLicenses.php index 888c399..ec709ab 100644 --- a/src/Commands/CountUsedLicenses.php +++ b/src/Commands/CountUsedLicenses.php @@ -14,13 +14,12 @@ class CountUsedLicenses extends Command { - /** @var string */ protected static $defaultName = 'count'; public function __construct( private readonly UsedLicensesParser $usedLicensesParser ) { - parent::__construct(self::$defaultName); + parent::__construct((string) self::$defaultName); } protected function configure(): void diff --git a/src/Commands/GenerateConfig.php b/src/Commands/GenerateConfig.php index 168faba..083012d 100644 --- a/src/Commands/GenerateConfig.php +++ b/src/Commands/GenerateConfig.php @@ -16,14 +16,13 @@ class GenerateConfig extends Command { - /** @var string */ protected static $defaultName = 'generate-config'; public function __construct( private readonly AllowedLicensesParser $allowedLicensesParser, private readonly UsedLicensesParser $usedLicensesParser ) { - parent::__construct(self::$defaultName); + parent::__construct((string) self::$defaultName); } protected function configure(): void diff --git a/src/Commands/ListAllowedLicenses.php b/src/Commands/ListAllowedLicenses.php index c217f0b..ae673e3 100644 --- a/src/Commands/ListAllowedLicenses.php +++ b/src/Commands/ListAllowedLicenses.php @@ -13,13 +13,12 @@ class ListAllowedLicenses extends Command { - /** @var string */ protected static $defaultName = 'allowed'; public function __construct( private readonly AllowedLicensesParser $allowedLicensesParser ) { - parent::__construct(self::$defaultName); + parent::__construct((string) self::$defaultName); } protected function configure(): void diff --git a/src/Commands/ListUsedLicenses.php b/src/Commands/ListUsedLicenses.php index 3f45398..4693c40 100644 --- a/src/Commands/ListUsedLicenses.php +++ b/src/Commands/ListUsedLicenses.php @@ -14,13 +14,12 @@ class ListUsedLicenses extends Command { - /** @var string */ protected static $defaultName = 'used'; public function __construct( private readonly UsedLicensesParser $usedLicensesParser ) { - parent::__construct(self::$defaultName); + parent::__construct((string) self::$defaultName); } protected function configure(): void