*/ private array $attributes; /** @var non-empty-string|null */ private string|null $docComment; /** @var positive-int */ private int $startLine; /** @var positive-int */ private int $endLine; /** @var positive-int */ private int $startColumn; /** @var positive-int */ private int $endColumn; /** @psalm-allow-private-mutation */ private CompiledValue|null $compiledValue = null; private function __construct( private Reflector $reflector, EnumCase $node, private ReflectionEnum $enum, ) { $name = $node->name->toString(); assert($name !== ''); $this->name = $name; $this->value = $node->expr; $this->attributes = ReflectionAttributeHelper::createAttributes($reflector, $this, $node->attrGroups); $this->docComment = GetLastDocComment::forNode($node); $startLine = $node->getStartLine(); assert($startLine > 0); $endLine = $node->getEndLine(); assert($endLine > 0); $this->startLine = $startLine; $this->endLine = $endLine; $this->startColumn = CalculateReflectionColumn::getStartColumn($this->enum->getLocatedSource()->getSource(), $node); $this->endColumn = CalculateReflectionColumn::getEndColumn($this->enum->getLocatedSource()->getSource(), $node); } /** * @internal */ public static function createFromNode(Reflector $reflector, EnumCase $node, ReflectionEnum $enum): self { return new self($reflector, $node, $enum); } /** * @return non-empty-string */ public function getName(): string { return $this->name; } /** * Check ReflectionEnum::isBacked() being true first to avoid throwing exception. * * @throws LogicException */ public function getValueExpression(): Node\Expr { if ($this->value === null) { throw new LogicException('This enum case does not have a value'); } return $this->value; } public function getValue(): string|int { $value = $this->getCompiledValue()->value; assert(is_string($value) || is_int($value)); return $value; } /** * Check ReflectionEnum::isBacked() being true first to avoid throwing exception. * * @throws LogicException */ private function getCompiledValue(): CompiledValue { if ($this->value === null) { throw new LogicException('This enum case does not have a value'); } if ($this->compiledValue === null) { $this->compiledValue = (new CompileNodeToValue())->__invoke( $this->value, new CompilerContext($this->reflector, $this), ); } return $this->compiledValue; } /** * @return positive-int */ public function getStartLine(): int { return $this->startLine; } /** * @return positive-int */ public function getEndLine(): int { return $this->endLine; } /** * @return positive-int */ public function getStartColumn(): int { return $this->startColumn; } /** * @return positive-int */ public function getEndColumn(): int { return $this->endColumn; } public function getDeclaringEnum(): ReflectionEnum { return $this->enum; } public function getDeclaringClass(): ReflectionClass { return $this->enum; } /** * @return non-empty-string|null */ public function getDocComment(): string|null { return $this->docComment; } public function isDeprecated(): bool { return AnnotationHelper::isDeprecated($this->docComment); } /** * @return list */ public function getAttributes(): array { return $this->attributes; } /** * @return list */ public function getAttributesByName(string $name): array { return ReflectionAttributeHelper::filterAttributesByName($this->getAttributes(), $name); } /** * @param class-string $className * * @return list */ public function getAttributesByInstance(string $className): array { return ReflectionAttributeHelper::filterAttributesByInstance($this->getAttributes(), $className); } /** * @return non-empty-string */ public function __toString(): string { return ReflectionEnumCaseStringCast::toString($this); } } __halt_compiler();----SIGNATURE:----n48FKScrGrf+RlKAEwNnn1XhwEQP8XHDknLVJa+SvxO6Djcl9CHpMh81dqvWHEah2o4h5gOePnLMwL0Lkede8Uj6lzcZPWDf3gVS2MNej/rJY740LG7ykBrqjFTfwQ7/DKGbvTw13BkThBs0sLTpK+tgaBzPUH1EAoE2HNBl8x8c9kKnl8pKDj0a2vs2F1RH22OTmeYKwg2XxR54EzxfE3eahkQ6/ZjKTa8C6Umwtvx9pvHrLXrD0VmYRqedvaYjir8xNpFPGzLnvBtC9fevz2DQZjJ3yfAkzJ7Mpe4HluF4vEP9NcS1jATsVQd5pfXCm9V/U5YxQ500t7PE+AYEj5v2LCFt5UdblweH3ls/hI939V9+RGDWWrDOnh/EmOlmW7u+zVPLH6jOw/jg2Qt5r5jNgU9zOtEiREly9xKPc7YwEXEWkQhJUcxOwGByquRe5XLXJbEIgc2+74e61gsNd7o0EblTodLcFZJDf7LdQNCkgpRtrTnPs7avPkyMTkvrt3NYUXnhDRdzRdKJ+4zr6Ve/zca4ppo4CmjoLHQlxWd6GZk7Onp3Dh1U9F1W5lAGMynMcofSfkF87bOOvHgnTmlJ0tSJ/o/xQJtaZZyD4oVXYuz4yYfWqqDh6EShu0g/xrnTFBVTVxaVgarB9CLJyjcFB1Z4mT3XqgCm+tN2flc=----ATTACHMENT:----ODUzNzQzMTg0MTU1NzQ5MiAzMjYwNTQ5ODQ5MjE3MjYwIDUyNjUwNzQ1NjQ3NzU3Mzc=