diff --git a/src/Validator/Inject/Phone.php b/src/Validator/Inject/Phone.php index e70e85d..9e45168 100644 --- a/src/Validator/Inject/Phone.php +++ b/src/Validator/Inject/Phone.php @@ -18,6 +18,9 @@ class Phone implements ValidatorInterface */ public function dispatch(mixed $data, object $class): bool { + if ($data == null || !is_numeric($data)) { + return false; + } return preg_match(self::REG, $data); } } diff --git a/src/Validator/Inject/Round.php b/src/Validator/Inject/Round.php index efe9094..1a4134d 100644 --- a/src/Validator/Inject/Round.php +++ b/src/Validator/Inject/Round.php @@ -25,6 +25,9 @@ class Round implements ValidatorInterface */ public function dispatch(mixed $data, object $class): bool { - return round($data, $this->value) === $data; + if ($data === null) { + return false; + } + return round((float)$data, $this->value) === $data; } }