This commit is contained in:
xl
2023-11-09 22:15:45 +08:00
parent 9fde20fccf
commit 988f78b8e0
2 changed files with 7 additions and 1 deletions
+3
View File
@@ -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);
}
}
+4 -1
View File
@@ -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;
}
}