Skip to content

Commit

Permalink
documenting validation error when after method defined on a form request
Browse files Browse the repository at this point in the history
  • Loading branch information
romalytvynenko committed May 19, 2024
1 parent 0450bc4 commit a48a8da
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Support/OperationExtensions/ErrorResponsesExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ private function attachCustomRequestExceptions(FunctionType $methodType)

$formRequest = $this->infer->analyzeClass($formRequest->name);

if ($formRequest->hasMethodDefinition('rules')) {
if (
$formRequest->hasMethodDefinition('rules')
|| $formRequest->hasMethodDefinition('after')
) {
$methodType->exceptions = [
...$methodType->exceptions,
new ObjectType(ValidationException::class),
Expand Down

0 comments on commit a48a8da

Please sign in to comment.