1
0
Fork 0
mirror of https://github.com/archtechx/enums.git synced 2025-12-12 11:14:05 +00:00

Added "Invokable Cases" PHPStan extension (#13)

* 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
This commit is contained in:
Samuel Levy 2022-08-25 08:27:44 +10:00 committed by GitHub
parent 7e17b84451
commit 373a86a16e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 382 additions and 0 deletions

View file

@ -0,0 +1,26 @@
<?php
declare(strict_types=1);
namespace ArchTech\Enums\Tests\PHPStan\InvokableCases;
use ArchTech\Enums\InvokableCases;
enum Status: int
{
use InvokableCases;
case created = 0;
case running = 1;
case done = 2;
public static function initial(): self
{
return self::created;
}
public function isStarted(): bool
{
return $this->value > self::created->value;
}
}