From ff3415e3c3fc04cca833ca1cf12dd1473d7d4347 Mon Sep 17 00:00:00 2001 From: woutersioen Date: Tue, 26 Mar 2024 14:06:40 +0100 Subject: [PATCH] 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