modify value type
This commit is contained in:
@@ -64,6 +64,12 @@ class Validator
|
||||
}
|
||||
foreach ($data as $key => $value) {
|
||||
if (property_exists($this->formData, $key)) {
|
||||
$type = new \ReflectionProperty($this->formData, $key);
|
||||
$value = match ($type->getType()->getName()) {
|
||||
'int' => (int)$value,
|
||||
'float' => (float)$value,
|
||||
default => $value
|
||||
};
|
||||
$this->formData->{$key} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user