From c88133045104a338c718002c198ee2bad1ab47c6 Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Wed, 7 Jan 2026 11:32:42 +0100 Subject: [PATCH 1/4] Add PHP 8.4 support and require PHP 8.3+ --- .github/workflows/build.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ec3a74d..fba17bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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: diff --git a/composer.json b/composer.json index 5e4129b..38189bd 100644 --- a/composer.json +++ b/composer.json @@ -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", From 889613352e77f739e19ab3c26636e7ab92b96fe9 Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Wed, 7 Jan 2026 13:05:02 +0100 Subject: [PATCH 2/4] Fix PHP 8.4 implicit nullable parameter deprecations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/AbsoluteDateClock.php | 2 +- src/Normalizer/AbsoluteDateNormalizer.php | 6 +++--- src/Translatable/AbsoluteDateTranslatable.php | 2 +- src/Twig/Extension/AbsoluteDateExtension.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/AbsoluteDateClock.php b/src/AbsoluteDateClock.php index 089eb20..bb24cc2 100644 --- a/src/AbsoluteDateClock.php +++ b/src/AbsoluteDateClock.php @@ -17,7 +17,7 @@ public static function now(\DateTimeZone $timeZone = null): 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)); } diff --git a/src/Normalizer/AbsoluteDateNormalizer.php b/src/Normalizer/AbsoluteDateNormalizer.php index 4774219..034cd2d 100644 --- a/src/Normalizer/AbsoluteDateNormalizer.php +++ b/src/Normalizer/AbsoluteDateNormalizer.php @@ -24,7 +24,7 @@ class AbsoluteDateNormalizer implements NormalizerInterface, DenormalizerInterfa * @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( @@ -42,7 +42,7 @@ public function normalize($object, string $format = null, array $context = []): * {@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; } @@ -53,7 +53,7 @@ public function supportsNormalization(mixed $data, string $format = null, array * @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 { $dateTimeFormat = $context[self::FORMAT_KEY] ?? AbsoluteDate::DEFAULT_DATE_FORMAT; diff --git a/src/Translatable/AbsoluteDateTranslatable.php b/src/Translatable/AbsoluteDateTranslatable.php index f5cc045..21407d7 100644 --- a/src/Translatable/AbsoluteDateTranslatable.php +++ b/src/Translatable/AbsoluteDateTranslatable.php @@ -34,7 +34,7 @@ public function __construct( $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(); diff --git a/src/Twig/Extension/AbsoluteDateExtension.php b/src/Twig/Extension/AbsoluteDateExtension.php index 17b5650..fcd6120 100644 --- a/src/Twig/Extension/AbsoluteDateExtension.php +++ b/src/Twig/Extension/AbsoluteDateExtension.php @@ -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); } From dbc80b4cfb878889bac09bb904757fda53321a0c Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Tue, 27 Jan 2026 16:32:20 +0100 Subject: [PATCH 3/4] Dropping support for Symfony 6 --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 38189bd..bf78e8e 100644 --- a/composer.json +++ b/composer.json @@ -15,19 +15,19 @@ }, "require-dev": { "symfony/contracts": "^2.4", - "symfony/translation": "^6.0|^7.0", + "symfony/translation": "^7.0", "assoconnect/php-quality-config": "^1.16", "assoconnect/validator-bundle": "^2.19" }, "require": { "ext-intl": "*", "php": "^8.3", - "symfony/framework-bundle": "^6.0|^7.0", + "symfony/framework-bundle": "^7.0", "assoconnect/php-date": "^2.11", "doctrine/dbal": "^2.10|^3.0", - "symfony/serializer": "^6.0|^7.0", + "symfony/serializer": "^7.0", "twig/twig": "^3", - "symfony/clock": "^6.4|^7.3" + "symfony/clock": "^7.3" }, "config": { "allow-plugins": { From b6125eb9ce8db0224d0f5dc31dec319bc39e50ba Mon Sep 17 00:00:00 2001 From: Sylvain Fabre Date: Tue, 27 Jan 2026 16:55:47 +0100 Subject: [PATCH 4/4] Fixes --- src/AbsoluteDateClock.php | 10 ++++------ src/Normalizer/AbsoluteDateNormalizer.php | 6 +++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/AbsoluteDateClock.php b/src/AbsoluteDateClock.php index bb24cc2..3bc84b2 100644 --- a/src/AbsoluteDateClock.php +++ b/src/AbsoluteDateClock.php @@ -5,20 +5,18 @@ namespace AssoConnect\PHPDateBundle; use AssoConnect\PHPDate\AbsoluteDate; +use DateTimeZone; use Symfony\Component\Clock\DatePoint; class AbsoluteDateClock { - public static function now(\DateTimeZone $timeZone = null): AbsoluteDate + public static function now(?DateTimeZone $timeZone = null): AbsoluteDate { return self::relative('now', $timeZone); } - /** - * @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)); + return AbsoluteDate::createInTimezone($timezone ?? new DateTimeZone('UTC'), new DatePoint($relative)); } } diff --git a/src/Normalizer/AbsoluteDateNormalizer.php b/src/Normalizer/AbsoluteDateNormalizer.php index 034cd2d..77b4628 100644 --- a/src/Normalizer/AbsoluteDateNormalizer.php +++ b/src/Normalizer/AbsoluteDateNormalizer.php @@ -24,9 +24,9 @@ class AbsoluteDateNormalizer implements NormalizerInterface, DenormalizerInterfa * @param mixed[] $context * @throws InvalidArgumentException */ - public function normalize($object, ?string $format = null, array $context = []): string + public function normalize(mixed $data, ?string $format = null, array $context = []): string { - if (!$object instanceof AbsoluteDate) { + if (!$data instanceof AbsoluteDate) { throw new InvalidArgumentException(sprintf( 'The object must be an instance of "%s".', AbsoluteDate::class @@ -35,7 +35,7 @@ public function normalize($object, ?string $format = null, array $context = []): $dateTimeFormat = $context[self::FORMAT_KEY] ?? AbsoluteDate::DEFAULT_DATE_FORMAT; - return $object->format($dateTimeFormat); + return $data->format($dateTimeFormat); } /**