This commit is contained in:
2023-12-12 15:35:35 +08:00
parent 968d572e84
commit 65d41ab868
29 changed files with 646 additions and 701 deletions
+3 -8
View File
@@ -28,8 +28,7 @@ class BindForm implements InjectParameterInterface
* @param string $class
* @param string $method
* @return mixed
* @throws ReflectionException
* @throws Exception
* @throws
*/
public function dispatch(string $class, string $method): object
{
@@ -38,10 +37,6 @@ class BindForm implements InjectParameterInterface
$reflect = $container->getReflectionClass($this->formValidate);
$object = $validator->setFormData($reflect->newInstanceWithoutConstructor());
foreach ($reflect->getProperties() as $property) {
// $binding = $property->getAttributes(Binding::class);
// if (count($binding) < 1) {
// continue;
// }
foreach ($property->getAttributes() as $attribute) {
if (!class_exists($attribute->getName())) {
continue;
@@ -70,7 +65,7 @@ class BindForm implements InjectParameterInterface
* @param object $object
* @param string $property
* @return void
* @throws Exception
* @throws
*/
private function insertDefaultValue(ReflectionNamedType|ReflectionUnionType $reflectionProperty, object $object, string $property): void
{
@@ -87,7 +82,7 @@ class BindForm implements InjectParameterInterface
/**
* @param ReflectionNamedType $type
* @return array|false|int|string
* @throws Exception
* @throws
*/
private function defaultValue(ReflectionNamedType $type): array|false|int|string
{
+1 -3
View File
@@ -3,7 +3,6 @@ declare(strict_types=1);
namespace Kiri\Router\Validator;
use Kiri;
use Kiri\Router\Constrict\ConstrictRequest;
use Kiri\Router\Interface\ValidatorInterface;
use Psr\Http\Message\RequestInterface;
@@ -91,8 +90,7 @@ class Validator
/**
* @param RequestInterface|ServerRequestInterface|ConstrictRequest $request
* @return bool
* @throws ReflectionException
* @throws \Exception
* @throws
*/
public function run(RequestInterface|ServerRequestInterface|ConstrictRequest $request): bool
{
+1 -2
View File
@@ -3,7 +3,6 @@ declare(strict_types=1);
namespace Kiri\Router\Validator;
use Exception;
use Kiri\Di\Inject\Container;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
@@ -31,7 +30,7 @@ class ValidatorMiddleware implements MiddlewareInterface
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
* @throws Exception
* @throws
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{