Skip to content

Commit

Permalink
Make psalm happy by casting to string
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
WouterSioen committed Mar 26, 2024
1 parent 3087074 commit ff3415e
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/Commands/CheckLicenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

class CheckLicenses extends Command
{
/** @var string */
protected static $defaultName = 'check';

public function __construct(
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/CountUsedLicenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/GenerateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/ListAllowedLicenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/Commands/ListUsedLicenses.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff3415e

Please sign in to comment.