Added new method Enum::fromValue(mixed $value): static
.
Example:
<?php
use Nelexa\Enum;
/**
* @method static self PENDING()
* @method static self ACTIVE()
* @method static self INACTIVE()
* @method static self DELETED()
*/
class UserStatus extends Enum
{
public const
PENDING = 1,
ACTIVE = 1 << 1,
INACTIVE = 1 << 2,
DELETED = 1 << 3;
}
assert(UserStatus::fromValue(1 << 1) === UserStatus::valueOf('ACTIVE'));