|
7 | 7 |
|
8 | 8 | class RuntimeEvaluationResult
|
9 | 9 | {
|
| 10 | + public const TYPE_ERROR = 'error'; |
| 11 | + public const TYPE_ANNOTATION = 'annotation'; |
| 12 | + |
| 13 | + public string $type = self::TYPE_ANNOTATION; |
10 | 14 | public bool $valid = true;
|
11 | 15 | public ?string $error = null;
|
12 | 16 | public mixed $errorMeta = null;
|
13 |
| - private mixed $annotation = null; |
14 |
| - public ?bool $suppressAnnotation = false; |
15 |
| - private ?bool $evaluationResult = null; |
| 17 | + private mixed $annotationValue = null; |
16 | 18 |
|
17 | 19 | public function __construct(
|
18 | 20 | public readonly int $number,
|
19 | 21 | public readonly KeywordInterface $keyword,
|
| 22 | + public readonly mixed $keywordValue, |
20 | 23 | public readonly string $keywordLocation,
|
21 | 24 | public readonly string $instanceLocation,
|
22 | 25 | public readonly ?string $absoluteKeywordLocation
|
23 | 26 | ) {}
|
24 | 27 |
|
25 |
| - public function setEvaluationResult(bool $evaluationResult): void |
| 28 | + public function setAnnotationValue(mixed $annotationValue): void |
26 | 29 | {
|
27 |
| - $this->evaluationResult = $evaluationResult; |
28 |
| - } |
29 |
| - |
30 |
| - public function getEvaluationResult(): bool |
31 |
| - { |
32 |
| - if ($this->evaluationResult === null) { |
33 |
| - return $this->valid; |
34 |
| - } |
35 |
| - |
36 |
| - return $this->evaluationResult; |
| 30 | + $this->annotationValue = $annotationValue; |
37 | 31 | }
|
38 | 32 |
|
39 |
| - public function setAnnotation(mixed $annotation): void |
| 33 | + public function getAnnotationValue(): mixed |
40 | 34 | {
|
41 |
| - $this->annotation = $annotation; |
42 |
| - } |
43 |
| - |
44 |
| - public function getAnnotation(bool $force = false): mixed |
45 |
| - { |
46 |
| - if (!$force && $this->suppressAnnotation) { |
47 |
| - return null; |
48 |
| - } |
49 |
| - |
50 |
| - return $this->annotation; |
| 35 | + return $this->annotationValue; |
51 | 36 | }
|
52 | 37 |
|
53 |
| - public function hasAnnotation(bool $force = false): bool |
| 38 | + public function hasAnnotationValue(): bool |
54 | 39 | {
|
55 |
| - return $this->getAnnotation($force) !== null; |
| 40 | + return $this->getAnnotationValue() !== null; |
56 | 41 | }
|
57 | 42 |
|
58 |
| - public function invalidate(string $error, mixed $errorMeta = null): void |
| 43 | + public function invalidate(?string $error = null, mixed $errorMeta = null): void |
59 | 44 | {
|
| 45 | + $this->type = self::TYPE_ERROR; |
60 | 46 | $this->error = $error;
|
61 | 47 | $this->errorMeta = $errorMeta;
|
62 | 48 | $this->valid = false;
|
|
0 commit comments