* SPDX-License-Identifier: MIT */ declare(strict_types=1); namespace Respect\Validation\Rules; use Attribute; use Respect\Validation\Message\Template; use Respect\Validation\Rules\Core\Simple; use function filter_var; use function is_float; use const FILTER_VALIDATE_FLOAT; #[Attribute(Attribute::TARGET_PROPERTY | Attribute::IS_REPEATABLE)] #[Template( '{{subject}} must be a float value', '{{subject}} must not be a float value', )] final class FloatVal extends Simple { public function isValid(mixed $input): bool { return is_float(filter_var($input, FILTER_VALIDATE_FLOAT)); } }