modify
This commit is contained in:
@@ -60,7 +60,7 @@ class LengthValidator extends BaseValidator
|
||||
return $this->addError('The param :attribute length overflow');
|
||||
}
|
||||
} else {
|
||||
if (is_numeric($value) && strlen(floatval($value)) > $this->value) {
|
||||
if (is_numeric($value) && strlen((string)$value) > $this->value) {
|
||||
return $this->addError('The param :attribute length overflow');
|
||||
}
|
||||
if (strlen($value) > $this->value) {
|
||||
@@ -83,7 +83,7 @@ class LengthValidator extends BaseValidator
|
||||
return $this->addError('The param :attribute length error');
|
||||
}
|
||||
} else {
|
||||
if (is_numeric($value) && strlen(floatval($value)) < $this->value) {
|
||||
if (is_numeric($value) && strlen((string)$value) < $this->value) {
|
||||
return $this->addError('The param :attribute length overflow');
|
||||
}
|
||||
if (strlen($value) < $this->value) {
|
||||
@@ -106,7 +106,7 @@ class LengthValidator extends BaseValidator
|
||||
return $this->addError('The param :attribute length error');
|
||||
}
|
||||
} else {
|
||||
if (is_numeric($value) && mb_strlen(floatval($value)) !== $this->value) {
|
||||
if (is_numeric($value) && strlen((string)$value) !== $this->value) {
|
||||
return $this->addError('The param :attribute length overflow');
|
||||
}
|
||||
if (mb_strlen($value) !== $this->value) {
|
||||
|
||||
@@ -126,7 +126,7 @@ class TypesOfValidator extends BaseValidator
|
||||
if (!is_numeric($value)) {
|
||||
return $this->addError('The ' . $this->field . ' not is number data.');
|
||||
}
|
||||
if (intval($value) != $value) {
|
||||
if ((int)$value != $value) {
|
||||
return $this->addError('The ' . $this->field . ' not is number data.');
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class TypesOfValidator extends BaseValidator
|
||||
*/
|
||||
public function floatFormat($value): bool
|
||||
{
|
||||
$trim = floatval((string)$value);
|
||||
$trim = (float)$value;
|
||||
if ($trim != $value || !is_float($trim)) {
|
||||
return $this->addError('The ' . $this->field . ' not is float data.');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user