Skip to content

Commit

Permalink
Cs fix
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelgfeller committed Jul 3, 2023
1 parent 761705d commit 6c0ed24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ public function __construct(
* @param Response $response
* @param array $args
*
* @return Response
* @throws \JsonException
*
* @return Response
*/
public function __invoke(ServerRequest $request, Response $response, array $args): Response
{
Expand Down
4 changes: 3 additions & 1 deletion src/Domain/Validation/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ public function validateEmail(
* @param \DateTimeImmutable|string|null $birthdate
* @param ValidationResult $validationResult
* @param bool $required
* @param string $format
*/
public function validateBirthdate(
\DateTimeImmutable|string|null $birthdate,
Expand All @@ -155,7 +156,7 @@ public function validateBirthdate(
// If birthdate is string, create DateTimeImmutable object for validation
$birthdateObj = DateTimeImmutable::createFromFormat($format, $birthdate);
// Allow default format Y-m-d as well (client creation via API submit)
if (false === $birthdateObj || array_sum($birthdateObj->getLastErrors())){
if (false === $birthdateObj || array_sum($birthdateObj->getLastErrors())) {
// Try with default format and original value
$birthdateObj = DateTimeImmutable::createFromFormat('Y-m-d', $birthdate);
}
Expand All @@ -165,6 +166,7 @@ public function validateBirthdate(
// Birthdate is not null, not a string with valid date and also not an instance of the custom
// DateTimeImmutable format (from the data object) it means that its invalid
$validationResult->setError('birthdate', __('Invalid value dd.mm.YYYY'));

return;
}

Expand Down

0 comments on commit 6c0ed24

Please sign in to comment.