mirror of
https://github.com/archtechx/enums.git
synced 2025-12-12 16:14:03 +00:00
Added "Invokable Cases" PHPStan extension testing
This commit is contained in:
parent
7e6914a52f
commit
72103f9eaf
6 changed files with 226 additions and 0 deletions
30
tests/PHPStan/InvokableCases/Suits.php
Normal file
30
tests/PHPStan/InvokableCases/Suits.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?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,
|
||||
};
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue