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