Commit 8f70f127 authored by Jan Kuchař's avatar Jan Kuchař

Enum::getAvailableValues(): support for getting all values of enum (will be...

Enum::getAvailableValues(): support for getting all values of enum (will be useful after scalar value refactoring merge)
parent e51fef64
Pipeline #14343 passed with stages
in 31 seconds
......@@ -21,11 +21,20 @@ abstract class Enum
* Provide values for given enum.
* @return array
* Provide values for given enum, never call this method directly.
* @return static[]
abstract protected static function provideInstances(): array;
* @return static[] Order and array keys are not guaranteed.
* For further value introspection use returned enum instances.
final public static function getAvailableValues(): array
return self::getMeta()->getValues();
* @return string[]|int[]
<?php declare(strict_types=1);
require __DIR__ . '/../bootstrap.php';
* @method static AvailableValuesEnum NEW()
* @method static AvailableValuesEnum ACTIVE()
class AvailableValuesEnum extends \Grifart\Enum\Enum
use Grifart\Enum\AutoInstances;
protected const NEW = 'new';
protected const ACTIVE = 'active';
[AvailableValuesEnum::NEW(), AvailableValuesEnum::ACTIVE()]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment