Skip to content

Commit ba1610c

Browse files
committed
Fix datetime properties in remaining entities
Signed-off-by: Tim Goudriaan <tim@codedmonkey.com>
1 parent 09ac406 commit ba1610c

5 files changed

Lines changed: 7 additions & 10 deletions

File tree

src/Controller/ApiController.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,9 @@ public function trackInstallations(Request $request): Response
145145
return new JsonResponse(['status' => 'error', 'message' => 'Invalid request format, must be a json object containing a downloads key filled with an array of name/version objects'], 200);
146146
}
147147

148-
$message = new TrackInstallations($contents['downloads'], new \DateTime());
149-
$envelope = new Envelope($message, [
150-
new TransportNamesStamp('async'),
151-
]);
152-
153-
$this->messenger->dispatch($envelope);
148+
$message = Envelope::wrap(new TrackInstallations($contents['downloads'], new \DateTimeImmutable()))
149+
->with(new TransportNamesStamp('async'));
150+
$this->messenger->dispatch($message);
154151

155152
return new JsonResponse(['status' => 'success'], Response::HTTP_CREATED);
156153
}

src/Doctrine/Entity/AbstractInstallations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function getMergedAt(): ?\DateTimeImmutable
5757
return $this->mergedAt;
5858
}
5959

60-
public function increase(\DateTimeInterface $date): void
60+
public function increase(\DateTimeImmutable $date): void
6161
{
6262
$key = $date->format('Ymd');
6363

src/Doctrine/Entity/ResetPasswordRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ResetPasswordRequest implements ResetPasswordRequestInterface
2121
#[ORM\JoinColumn(nullable: false)]
2222
private User $user;
2323

24-
public function __construct(User $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken)
24+
public function __construct(User $user, \DateTimeImmutable $expiresAt, string $selector, string $hashedToken)
2525
{
2626
$this->user = $user;
2727
$this->initialize($expiresAt, $selector, $hashedToken);

src/Doctrine/Repository/ResetPasswordRequestRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public function __construct(ManagerRegistry $registry)
2727
*/
2828
public function createResetPasswordRequest(object $user, \DateTimeInterface $expiresAt, string $selector, string $hashedToken): ResetPasswordRequestInterface
2929
{
30-
return new ResetPasswordRequest($user, $expiresAt, $selector, $hashedToken);
30+
return new ResetPasswordRequest($user, \DateTimeImmutable::createFromInterface($expiresAt), $selector, $hashedToken);
3131
}
3232
}

src/Message/TrackInstallations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
public function __construct(
88
public array $installations,
9-
public \DateTimeInterface $installedAt,
9+
public \DateTimeImmutable $installedAt,
1010
) {
1111
}
1212
}

0 commit comments

Comments
 (0)