eee
This commit is contained in:
@@ -16,10 +16,7 @@ class ArrayProxy extends TypesProxy
|
||||
public function dispatch(object $form, string $field, mixed $value): bool
|
||||
{
|
||||
if (is_null($value)) {
|
||||
if (!$this->allowsNull) {
|
||||
return false;
|
||||
}
|
||||
$form->{$field} = [];
|
||||
$form->{$field} = !$this->allowsNull ? [] : null;
|
||||
return true;
|
||||
}
|
||||
return $value == ($form->{$field} = $value);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
namespace Kiri\Router\Validator\Types;
|
||||
|
||||
namespace Kiri\Router\Validator\Types;
|
||||
|
||||
|
||||
class BoolProxy extends TypesProxy
|
||||
@@ -16,11 +16,8 @@ class BoolProxy extends TypesProxy
|
||||
public function dispatch(object $form, string $field, mixed $value): bool
|
||||
{
|
||||
if (is_null($value)) {
|
||||
if (!$this->allowsNull) {
|
||||
return false;
|
||||
}
|
||||
$form->{$field} = false;
|
||||
return false;
|
||||
$form->{$field} = !$this->allowsNull ? false : null;
|
||||
return true;
|
||||
}
|
||||
// TODO: Implement dispatch() method.
|
||||
if (in_array($value, ['false', 'true'])) {
|
||||
|
||||
@@ -15,11 +15,8 @@ class FloatProxy extends TypesProxy
|
||||
public function dispatch(object $form, string $field, mixed $value): bool
|
||||
{
|
||||
if (is_null($value)) {
|
||||
if (!$this->allowsNull) {
|
||||
return false;
|
||||
}
|
||||
$form->{$field} = 0;
|
||||
return false;
|
||||
$form->{$field} = !$this->allowsNull ? 0 : null;
|
||||
return true;
|
||||
}
|
||||
return $value == ($form->{$field} = (float)$value);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,8 @@ class IntProxy extends TypesProxy
|
||||
public function dispatch(object $form, string $field, mixed $value): bool
|
||||
{
|
||||
if (is_null($value)) {
|
||||
if (!$this->allowsNull) {
|
||||
return false;
|
||||
}
|
||||
$form->{$field} = 0;
|
||||
return false;
|
||||
$form->{$field} = !$this->allowsNull ? 0 : null;
|
||||
return true;
|
||||
}
|
||||
return $value == ($form->{$field} = (int)$value);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,8 @@ class StringProxy extends TypesProxy
|
||||
public function dispatch(object $form, string $field, mixed $value): bool
|
||||
{
|
||||
if (is_null($value)) {
|
||||
if (!$this->allowsNull) {
|
||||
return false;
|
||||
}
|
||||
$form->{$field} = '';
|
||||
return false;
|
||||
$form->{$field} = !$this->allowsNull ? '' : null;
|
||||
return true;
|
||||
}
|
||||
return $value == ($form->{$field} = (string)$value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user