diff --git a/src/Http/Request/Admin/ProfileRequest.php b/src/Http/Request/Admin/ProfileRequest.php index f16f833..c2fa3c7 100644 --- a/src/Http/Request/Admin/ProfileRequest.php +++ b/src/Http/Request/Admin/ProfileRequest.php @@ -14,7 +14,7 @@ public function __construct(protected readonly EntityManager $em, protected read { } - public function schema(): array + public function schema(array $data): array { return []; } diff --git a/src/Http/Request/Admin/UploadAvatarRequest.php b/src/Http/Request/Admin/UploadAvatarRequest.php index 7b6d66f..31dc8ad 100644 --- a/src/Http/Request/Admin/UploadAvatarRequest.php +++ b/src/Http/Request/Admin/UploadAvatarRequest.php @@ -16,7 +16,7 @@ public function __construct(protected readonly AuthUser $user, protected readonl { } - public function schema(): array + public function schema(array $data): array { return ['avatar' => Expect::type(UploadedFile::class)->required()]; } diff --git a/src/Http/Request/Auth/EmailAuthRequest.php b/src/Http/Request/Auth/EmailAuthRequest.php index 557210c..47550b9 100644 --- a/src/Http/Request/Auth/EmailAuthRequest.php +++ b/src/Http/Request/Auth/EmailAuthRequest.php @@ -27,7 +27,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $all = $this->entityFinder->findAll(); $filtered = array_filter($all, fn($item) => is_subclass_of($item['className'], IAuthenticable::class)); diff --git a/src/Http/Request/Auth/RevokeTokenRequest.php b/src/Http/Request/Auth/RevokeTokenRequest.php index 0b7260b..ccc2714 100644 --- a/src/Http/Request/Auth/RevokeTokenRequest.php +++ b/src/Http/Request/Auth/RevokeTokenRequest.php @@ -19,7 +19,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $all = $this->entityFinder->findAll(); $filtered = array_filter($all, fn($item) => is_subclass_of($item['className'], IAuthenticable::class)); diff --git a/src/Http/Request/Collection/CreateRequest.php b/src/Http/Request/Collection/CreateRequest.php index 7fefaad..f42f10e 100644 --- a/src/Http/Request/Collection/CreateRequest.php +++ b/src/Http/Request/Collection/CreateRequest.php @@ -32,7 +32,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/Collection/DeleteRequest.php b/src/Http/Request/Collection/DeleteRequest.php index 89a8a70..5b8108d 100644 --- a/src/Http/Request/Collection/DeleteRequest.php +++ b/src/Http/Request/Collection/DeleteRequest.php @@ -26,7 +26,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/Collection/Form/CreatingFormRequest.php b/src/Http/Request/Collection/Form/CreatingFormRequest.php index 3630e7a..9b13b61 100644 --- a/src/Http/Request/Collection/Form/CreatingFormRequest.php +++ b/src/Http/Request/Collection/Form/CreatingFormRequest.php @@ -23,7 +23,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/Collection/Form/UpdatingFormRequest.php b/src/Http/Request/Collection/Form/UpdatingFormRequest.php index 8d0ae89..46b8eca 100644 --- a/src/Http/Request/Collection/Form/UpdatingFormRequest.php +++ b/src/Http/Request/Collection/Form/UpdatingFormRequest.php @@ -29,7 +29,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/Collection/NavbarRequest.php b/src/Http/Request/Collection/NavbarRequest.php index 901e788..9b76bd7 100644 --- a/src/Http/Request/Collection/NavbarRequest.php +++ b/src/Http/Request/Collection/NavbarRequest.php @@ -19,7 +19,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { return []; } diff --git a/src/Http/Request/Collection/ReadRequest.php b/src/Http/Request/Collection/ReadRequest.php index b7f418f..6454523 100644 --- a/src/Http/Request/Collection/ReadRequest.php +++ b/src/Http/Request/Collection/ReadRequest.php @@ -31,7 +31,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/Collection/UpdateRequest.php b/src/Http/Request/Collection/UpdateRequest.php index 29260b4..7720e3a 100644 --- a/src/Http/Request/Collection/UpdateRequest.php +++ b/src/Http/Request/Collection/UpdateRequest.php @@ -33,7 +33,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { $recipeKeys = array_map(fn($r) => $r->key(), $this->recipeFinder->load()->getAll()); diff --git a/src/Http/Request/IRequest.php b/src/Http/Request/IRequest.php index 3c1619d..440563f 100644 --- a/src/Http/Request/IRequest.php +++ b/src/Http/Request/IRequest.php @@ -8,9 +8,10 @@ interface IRequest { /** + * @param array $data * @return array */ - public function schema(): array; + public function schema(array $data): array; /** * @param array $data diff --git a/src/Http/Request/Request.php b/src/Http/Request/Request.php index 2294858..95b34e8 100644 --- a/src/Http/Request/Request.php +++ b/src/Http/Request/Request.php @@ -45,7 +45,7 @@ public function __invoke(SymfonyRequest $request): Response $this->request = $request; $data = $this->getRequestData(); - $schema = $this->schema(); + $schema = $this->schema($data); if (count($schema) !== 0) { try { diff --git a/src/Http/Request/Resource/CreateRoleRequest.php b/src/Http/Request/Resource/CreateRoleRequest.php index 21c4b55..9de94b0 100644 --- a/src/Http/Request/Resource/CreateRoleRequest.php +++ b/src/Http/Request/Resource/CreateRoleRequest.php @@ -16,7 +16,7 @@ public function __construct(protected EntityManager $em) { } - public function schema(): array + public function schema(array $data): array { return [ 'name' => Expect::string()->min(3)->max(32)->required(), diff --git a/src/Http/Request/Resource/DeleteRoleRequest.php b/src/Http/Request/Resource/DeleteRoleRequest.php index 6a2e265..913520c 100644 --- a/src/Http/Request/Resource/DeleteRoleRequest.php +++ b/src/Http/Request/Resource/DeleteRoleRequest.php @@ -15,7 +15,7 @@ public function __construct(protected EntityManager $em) { } - public function schema(): array + public function schema(array $data): array { return [ 'id' => Expect::string()->required(), diff --git a/src/Http/Request/Resource/ReadAllRequest.php b/src/Http/Request/Resource/ReadAllRequest.php index e18f750..3656eea 100644 --- a/src/Http/Request/Resource/ReadAllRequest.php +++ b/src/Http/Request/Resource/ReadAllRequest.php @@ -23,7 +23,7 @@ public function __construct( { } - public function schema(): array + public function schema(array $data): array { return [ 'view_resources' => Expect::arrayOf('string')->required(), diff --git a/src/Http/Request/Resource/UpdateRoleRequest.php b/src/Http/Request/Resource/UpdateRoleRequest.php index 9a39069..a083d88 100644 --- a/src/Http/Request/Resource/UpdateRoleRequest.php +++ b/src/Http/Request/Resource/UpdateRoleRequest.php @@ -16,7 +16,7 @@ public function __construct(protected EntityManager $em) { } - public function schema(): array + public function schema(array $data): array { return [ 'resource_id' => Expect::string()->required(),