mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 05:24:03 +00:00
* Added "Invokable Cases" PHPStan extension This includes a PHPStan extension to add support for `InvokableCases` so that static analysis tools can understand the callable methods and their return types. The extension has been added in a way that will allow multiple extensions in the future if required, with a single include file that will import all extensions, or the option to include only specific extensions. * Added "Invokable Cases" PHPStan extension testing
30 lines
523 B
PHP
30 lines
523 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace ArchTech\Enums\Tests\PHPStan\InvokableCases;
|
|
|
|
use ArchTech\Enums\InvokableCases;
|
|
|
|
enum Suits: string
|
|
{
|
|
use InvokableCases;
|
|
|
|
case clubs = 'C';
|
|
case diamonds = 'D';
|
|
case hearts = 'H';
|
|
case spades = 'S';
|
|
|
|
public static function valuable(): self
|
|
{
|
|
return self::diamonds;
|
|
}
|
|
|
|
public function isRed(): bool
|
|
{
|
|
return match ($this) {
|
|
self::diamonds, self::hearts => true,
|
|
default => false,
|
|
};
|
|
}
|
|
}
|