Skip to content

Commit 2e4139e

Browse files
bpolaszeknorkunas
authored andcommitted
chore: apply review advices
1 parent 35f513d commit 2e4139e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Services/UnixTimestampNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class UnixTimestampNormalizer implements NormalizerInterface
1313
*/
1414
public function normalize(mixed $object, string $format = null, array $context = []): int
1515
{
16-
return (int) $object->format('U');
16+
return $object->getTimestamp();
1717
}
1818

1919
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool

tests/Unit/SerializationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public function testSimpleEntityToSearchableArray(): void
4747
'id' => 12,
4848
'title' => 'a simple post',
4949
'content' => 'some text',
50-
'publishedAt' => (int) $datetime->format('U'),
50+
'publishedAt' => $datetime->getTimestamp(),
5151
'comments' => [
5252
[
5353
'id' => null,
5454
'content' => 'a great comment',
55-
'publishedAt' => (int) $datetime->format('U'),
55+
'publishedAt' => $datetime->getTimestamp(),
5656
],
5757
],
5858
];

0 commit comments

Comments
 (0)