We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From:
final class Version { private const V1 = 'v1'; private const V2 = 'v2'; }
to:
final class Version { private const V1 = 'v1'; private const V2 = 'v2'; private const ALL_MAP = [ self::V1, self::V2, ]; /** * @var string */ private $value; private function __construct(string $value) { Assert::that($value)->inArray(Self::ALL_MAP); $this->value = $value; } public static function fromString(string $value): self { return new self($value); } public static function v1(): self { return new self(self::V1); } public static function v2(): self { return new self(self::V2); } public function toString(): string { return $this->value; } public function equals(Enum $other): bool { return $this->value === $other->value; } }
The text was updated successfully, but these errors were encountered:
ff96df2
No branches or pull requests
From:
to:
The text was updated successfully, but these errors were encountered: