isMatchedBy($this); } return $other instanceof self || $other instanceof ScalarConcreteType || $other instanceof MixedType; } public function inferGenericsFrom(Type $other, Generics $generics): Generics { return $generics; } public function canCast(mixed $value): bool { return is_numeric($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} is not a valid float.') ->withCode('invalid_float') ->build(); } public function nativeType(): NativeFloatType { return $this; } public function toString(): string { return 'float'; } }