Skip to content

Change signatures for validatedBody and validatedForm #44

@jakobmats

Description

@jakobmats

Currently validatedBody's signature is:

public function validatedBody(): Promise

But should read as:

/**
 * @return Promise<WrappedValue>
 */
public function validatedBody(string $validatorName): Promise;

Similarly validatedForm should yield a Promise that'll evaluate to something like WrapedForm which will allow for field-wise validation:

 /**
 * @return Promise<WrappedForm>
*/
public function validatedForm(): Promise;

Hence validation:

$form = yield $ctx->validatedForm();

$age = $form
    ->field('age')
    ->to('int')
    ->unwrap();

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions