*/ private array $cases = []; private ?string $type = null; public function setType(?string $type): static { $this->type = $type; return $this; } public function getType(): ?string { return $this->type; } /** * @param string[] $names */ public function setImplements(array $names): static { $this->validateNames($names); $this->implements = $names; return $this; } /** * @return string[] */ public function getImplements(): array { return $this->implements; } public function addImplement(string $name): static { $this->validateNames([$name]); $this->implements[] = $name; return $this; } public function removeImplement(string $name): static { $this->implements = array_diff($this->implements, [$name]); return $this; } /** * Sets cases to enum * @param EnumCase[] $cases */ public function setCases(array $cases): static { (function (EnumCase ...$cases) {})(...$cases); $this->cases = []; foreach ($cases as $case) { $this->cases[$case->getName()] = $case; } return $this; } /** * @return EnumCase[] */ public function getCases(): array { return $this->cases; } /** * Adds case to enum */ public function addCase(string $name, string|int|Literal|null $value = null): EnumCase { if (isset($this->cases[$name])) { throw new Nette\InvalidStateException("Cannot add cases '$name', because it already exists."); } return $this->cases[$name] = (new EnumCase($name)) ->setValue($value); } public function removeCase(string $name): static { unset($this->cases[$name]); return $this; } public function addMember(Method|Constant|EnumCase|TraitUse $member): static { $name = $member->getName(); [$type, $n] = match (true) { $member instanceof Constant => ['consts', $name], $member instanceof Method => ['methods', strtolower($name)], $member instanceof TraitUse => ['traits', $name], $member instanceof EnumCase => ['cases', $name], }; if (isset($this->$type[$n])) { throw new Nette\InvalidStateException("Cannot add member '$name', because it already exists."); } $this->$type[$n] = $member; return $this; } public function __clone() { $clone = fn($item) => clone $item; $this->consts = array_map($clone, $this->consts); $this->methods = array_map($clone, $this->methods); $this->traits = array_map($clone, $this->traits); $this->cases = array_map($clone, $this->cases); } } __halt_compiler();----SIGNATURE:----rZIhlihgWRbtPUoDRoDYaAQyD98oGGlGZ5rJuHkhLoK6b5QNLd6Enlh0RKA2l/qXINsesCeYGKU2tb/i2WEh7ivWGNvQvTztXA0BZ5ZHfSfmFe9ZL9sEDjT2AqrOya6/TxJARREdNyVq40AtSdQioFsO/Vvx8dmL+k8HILh5Pp8er4z9dEXodSweJf+mzT8XWS6e7l36235+T+o/kX8Sp0qlwKW/vqWyVTJCGMBMbe6F7xyTdH7sfYnaTp/PFX9obc5mCx7U2yZuYU2xV2XgeGTQUsilDx0X+/LKpTi0cRk/pl9kIJEV+fkw4wIqwkSmVGypD4DB33vnZpqQ0eDM9AKr6J0BKdZ8gyzxyjgMO/EFdp8LL4/cvgm5HRXtL4ybtOeWOgGG0BeIoaZegzWmnTLmHk1My8o9zaDk2R4+GN5Hs2A11/gqVx2FVkOE+hHLGFeoMlMS6Q7IWiMoOTdyFDnDZ2IynDzqca8mbK0qfVITanEC4eJR322WZ/Z93OJX1qOu2aCGd2nFsw9tLOAUKw18DMH7wB5Ux9oUPkNXQ5374C7FZvX5YsbgVjVPZAl9BElVpjK8qAWkHI49fnbOCo/RWQph3J0F8cUw/OOAjYvIile5esibP1dbhH9u9hyYNCT/QLsZYdNlHnJ+XeHpnXlWM5PZehRfrwLXiYcQ3iM=----ATTACHMENT:----MTI1ODMwNDk3NTE0ODgyMSAxNDM2NDU0MzAzOTI4NjA5IDczNjcxMTEyNDMxNzMxNzY=