This commit is contained in:
2023-12-04 23:26:57 +08:00
parent 013d570eb7
commit f23efc5823
+1 -5
View File
@@ -139,17 +139,13 @@ class Validator
throw new \Exception('Fail type value.'); throw new \Exception('Fail type value.');
} }
} else { } else {
$value = match ($property->getName()) { $this->formData->{$name} = match ($property->getName()) {
'int' => (int)$value, 'int' => (int)$value,
'float' => (float)$value, 'float' => (float)$value,
'bool' => $value == 'true', 'bool' => $value == 'true',
default => $value default => $value
}; };
} }
if ($value === 'Null') {
$value = null;
}
$this->formData->{$name} = $value;
} }
return true; return true;
} }