Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: ['8.2', '8.3']
php-versions: ['8.3', '8.4']
dependency-versions: ['lowest', 'highest']
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"require": {
"ext-intl": "*",
"php": "^7.4|^8.0",
"php": "^8.3",
"symfony/framework-bundle": "^6.0|^7.0",
"assoconnect/php-date": "^2.11",
"doctrine/dbal": "^2.10|^3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/AbsoluteDateClock.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function now(\DateTimeZone $timeZone): AbsoluteDate
/**
* @throws \DateMalformedStringException
*/
public static function relative(string $relative = 'now', \DateTimeZone $timezone = null): AbsoluteDate
public static function relative(string $relative = 'now', ?\DateTimeZone $timezone = null): AbsoluteDate
{
return AbsoluteDate::createInTimezone($timezone ?? new \DateTimeZone('UTC'), new DatePoint($relative));
}
Expand Down
6 changes: 3 additions & 3 deletions src/Normalizer/AbsoluteDateNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* @param mixed[] $context
* @throws InvalidArgumentException
*/
public function normalize($object, string $format = null, array $context = []): string
public function normalize($object, ?string $format = null, array $context = []): string
{
if (!$object instanceof AbsoluteDate) {
throw new InvalidArgumentException(sprintf(
Expand All @@ -42,7 +42,7 @@
* {@inheritdoc}
* @param mixed[] $context
*/
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
{
return $data instanceof AbsoluteDate;
}
Expand All @@ -53,7 +53,7 @@
* @param mixed[] $context
* @throws NotNormalizableValueException
*/
public function denormalize($data, string $type, string $format = null, array $context = []): ?AbsoluteDate
public function denormalize($data, string $type, ?string $format = null, array $context = []): ?AbsoluteDate

Check failure on line 56 in src/Normalizer/AbsoluteDateNormalizer.php

View workflow job for this annotation

GitHub Actions / build (8.4, highest)

Return type (AssoConnect\PHPDate\AbsoluteDate|null) of method AssoConnect\PHPDateBundle\Normalizer\AbsoluteDateNormalizer::denormalize() should be covariant with return type (($type is class-string<object> ? object : mixed)) of method Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize()

Check failure on line 56 in src/Normalizer/AbsoluteDateNormalizer.php

View workflow job for this annotation

GitHub Actions / build (8.3, highest)

Return type (AssoConnect\PHPDate\AbsoluteDate|null) of method AssoConnect\PHPDateBundle\Normalizer\AbsoluteDateNormalizer::denormalize() should be covariant with return type (($type is class-string<object> ? object : mixed)) of method Symfony\Component\Serializer\Normalizer\DenormalizerInterface::denormalize()
{
$dateTimeFormat = $context[self::FORMAT_KEY] ?? AbsoluteDate::DEFAULT_DATE_FORMAT;

Expand Down
2 changes: 1 addition & 1 deletion src/Translatable/AbsoluteDateTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
$this->timezone = new DateTimeZone('UTC');
}

public function trans(TranslatorInterface $translator, string $locale = null): string
public function trans(TranslatorInterface $translator, ?string $locale = null): string
{
if (null === $locale) {
$locale = $translator->getLocale();
Expand All @@ -57,7 +57,7 @@
$pattern = str_replace(
['yy', 'M', 'd'],
['y', 'MM', 'dd'],
$pattern !== false ? $pattern : AbsoluteDate::DEFAULT_DATE_FORMAT

Check failure on line 60 in src/Translatable/AbsoluteDateTranslatable.php

View workflow job for this annotation

GitHub Actions / build (8.3, lowest)

Strict comparison using !== between string and false will always evaluate to true.

Check failure on line 60 in src/Translatable/AbsoluteDateTranslatable.php

View workflow job for this annotation

GitHub Actions / build (8.3, lowest)

Else branch is unreachable because ternary operator condition is always true.
);
self::$formatters[$key]->setPattern($pattern);
}
Expand All @@ -69,6 +69,6 @@
throw new \RuntimeException(sprintf('Cannot format %s', $this->absoluteDate->__toString()));
}

return $formatted;

Check failure on line 72 in src/Translatable/AbsoluteDateTranslatable.php

View workflow job for this annotation

GitHub Actions / build (8.3, lowest)

Method AssoConnect\PHPDateBundle\Translatable\AbsoluteDateTranslatable::trans() should return string but returns string|true.
}
}
2 changes: 1 addition & 1 deletion src/Twig/Extension/AbsoluteDateExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getFilters(): array
];
}

public function formatAbsoluteDate(AbsoluteDate $date, string $locale = null): string
public function formatAbsoluteDate(AbsoluteDate $date, ?string $locale = null): string
{
return (new AbsoluteDateTranslatable($date))->trans($this->translator, $locale);
}
Expand Down
Loading