Skip to content

Commit

Permalink
Make PHPStan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Dec 9, 2023
1 parent 029e7a1 commit 753e56f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
12 changes: 2 additions & 10 deletions Hasser.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ public static function hasName(string $name): bool
*/
public static function hasValue(int|string $value): bool
{
if (!(new ReflectionEnum(static::class))->isBacked()) {
return false;
}

foreach (static::cases() as $enum) {
if ($enum->value === $value) { /* @phpstan-ignore-line */
if ($enum?->value === $value) { /* @phpstan-ignore-line */
return true;
}
}
Expand All @@ -65,12 +61,8 @@ public static function hasValue(int|string $value): bool
*/
public static function hasCase(string $name, int|string $value): bool
{
if (!(new ReflectionEnum(static::class))->isBacked()) {
return false;
}

foreach (static::cases() as $enum) {
if ($enum->name === $name && $enum->value === $value) { /* @phpstan-ignore-line */
if ($enum?->name === $name && $enum?->value === $value) { /* @phpstan-ignore-line */
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trait Info
{
public static function isBacked(): bool
{
return (new ReflectionEnum(static::class))->isBacked();
return (new ReflectionEnum(static::class))->isBacked(); /* @phpstan-ignore-line */
}

public static function isNotBacked(): bool
Expand Down

0 comments on commit 753e56f

Please sign in to comment.