Skip to content

Commit

Permalink
Address code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed Jun 8, 2023
1 parent 76cf596 commit b4e1b27
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/BadRequestError.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
use Exception;

/**
* BadRequestError indicates a malformatted request.
* BadRequestError indicates a malformatted request. This is thrown internally
* when a typed function cannot deserialize the request body.
* @internal
*/
class BadRequestError extends Exception
Expand Down
3 changes: 1 addition & 2 deletions src/CloudEventFunctionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ public function __construct(callable $function, bool $marshalToCloudEventInterfa

private function throwInvalidFirstParameterException(): void
{
$class = $this->getFunctionParameterClassName();
throw new LogicException(sprintf(
'Your function must have "%s" as the typehint for the first argument',
$class
$this->getFunctionParameterClassName()
));
}

Expand Down
5 changes: 5 additions & 0 deletions src/TypedFunctionWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ private function throwInvalidFirstParameterException(): void
);
}

/**
* @param ServerRequestInterface $request
* @return ResponseInterface
* @throws BadRequestException
*/
public function execute(ServerRequestInterface $request): ResponseInterface
{
try {
Expand Down

0 comments on commit b4e1b27

Please sign in to comment.