This commit is contained in:
2020-10-30 10:40:57 +08:00
parent e26439a439
commit 5fc484640a
+3 -4
View File
@@ -123,11 +123,10 @@ class TypesOfValidator extends BaseValidator
*/
public function integerFormat($value)
{
$trim = trim($value);
if (!is_numeric($trim)) {
if (!is_numeric($value)) {
return $this->addError('The ' . $this->field . ' not is number data.');
}
if ($trim != $value || intval($trim) != $value) {
if (intval($value) != $value) {
return $this->addError('The ' . $this->field . ' not is number data.');
}
@@ -140,7 +139,7 @@ class TypesOfValidator extends BaseValidator
*/
public function floatFormat($value)
{
$trim = floatval(trim($value));
$trim = floatval((string)$value);
if ($trim != $value || !is_float($trim)) {
return $this->addError('The ' . $this->field . ' not is float data.');
}