value; } public function compiledAccept(ComplianceNode $node): ComplianceNode { return $node->equals(Node::value($this->value)); } public function matches(Type $other): bool { return $other->accepts($this->value); } public function inferGenericsFrom(Type $other, Generics $generics): Generics { return $generics; } public function canCast(mixed $value): bool { return is_numeric($value) && (float)$value === $this->value; } public function cast(mixed $value): float { assert($this->canCast($value)); return (float)$value; // @phpstan-ignore-line } public function errorMessage(): ErrorMessage { return MessageBuilder::newError('Value {source_value} does not match float value {expected_value}.') ->withCode('invalid_float_value') ->withParameter('expected_value', (string)$this->value) ->build(); } public function value(): float { return $this->value; } public function nativeType(): NativeFloatType { return NativeFloatType::get(); } public function toString(): string { return (string)$this->value; } }