diff --git a/src/Type/Hexadecimal.php b/src/Type/Hexadecimal.php index 132b4e0..2676291 100644 --- a/src/Type/Hexadecimal.php +++ b/src/Type/Hexadecimal.php @@ -32,6 +32,9 @@ use function substr; */ final class Hexadecimal implements TypeInterface { + /** + * @var non-empty-string + */ private string $value; /** @@ -42,21 +45,33 @@ final class Hexadecimal implements TypeInterface $this->value = $value instanceof self ? (string) $value : $this->prepareValue($value); } + /** + * @psalm-return non-empty-string + */ public function toString(): string { return $this->value; } + /** + * @psalm-return non-empty-string + */ public function __toString(): string { return $this->toString(); } + /** + * @psalm-return non-empty-string + */ public function jsonSerialize(): string { return $this->toString(); } + /** + * @psalm-return non-empty-string + */ public function serialize(): string { return $this->toString(); @@ -94,6 +109,9 @@ final class Hexadecimal implements TypeInterface $this->unserialize($data['string']); } + /** + * @psalm-return non-empty-string + */ private function prepareValue(string $value): string { $value = strtolower($value); @@ -108,6 +126,7 @@ final class Hexadecimal implements TypeInterface ); } + /** @var non-empty-string */ return $value; } }