From 1e8f8053aae900805b1f4b132312bc008ac3c6f0 Mon Sep 17 00:00:00 2001 From: Marco Wansinck Date: Tue, 16 Jun 2026 15:49:26 +0200 Subject: [PATCH 1/4] fix: explicit nullable types for PHP 8.4 deprecations (MKO-1330) PHP 8.4 deprecates implicitly nullable parameters (a typed param with a null default). Make the nullability explicit with ?type in the serializer normalizers and Connection, removing the deprecation warnings: Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead - TimeWindowNormalizer, LocationNormalizer, ArrivalNormalizer: $format - Connection: $uri No behavioural change; tests, PHPStan and PHP-CS-Fixer stay green. --- src/Connection.php | 2 +- src/Serializer/Normalizer/ArrivalNormalizer.php | 4 ++-- src/Serializer/Normalizer/LocationNormalizer.php | 8 ++++---- src/Serializer/Normalizer/TimeWindowNormalizer.php | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Connection.php b/src/Connection.php index dbbcbbf..2af8241 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -24,7 +24,7 @@ final class Connection private ?HttpClientInterface $client = null; - public function __construct(string $uri = null) + public function __construct(?string $uri = null) { if ($uri) { $this->uri = $uri; diff --git a/src/Serializer/Normalizer/ArrivalNormalizer.php b/src/Serializer/Normalizer/ArrivalNormalizer.php index d2c2ece..625247e 100644 --- a/src/Serializer/Normalizer/ArrivalNormalizer.php +++ b/src/Serializer/Normalizer/ArrivalNormalizer.php @@ -14,12 +14,12 @@ final class ArrivalNormalizer implements DenormalizerInterface * * @throws \Exception */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): \DateTimeImmutable + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): \DateTimeImmutable { return DateTimeUtil::fromUTC(new \DateTimeImmutable('@'.$data)); } - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return 'DateTimeImmutable' === $type && is_int($data) && $data > 604800; } diff --git a/src/Serializer/Normalizer/LocationNormalizer.php b/src/Serializer/Normalizer/LocationNormalizer.php index 7a43fa7..7048399 100644 --- a/src/Serializer/Normalizer/LocationNormalizer.php +++ b/src/Serializer/Normalizer/LocationNormalizer.php @@ -13,7 +13,7 @@ final class LocationNormalizer implements NormalizerInterface, DenormalizerInter /** * @param Location $object */ - public function normalize(mixed $object, string $format = null, array $context = []): array + public function normalize(mixed $object, ?string $format = null, array $context = []): array { return [ $object->lon, @@ -24,7 +24,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * @param Location $data */ - 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 Location; } @@ -32,7 +32,7 @@ public function supportsNormalization(mixed $data, string $format = null, array /** * @param array $data */ - public function denormalize(mixed $data, string $type, string $format = null, array $context = []): Location + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): Location { return new Location($data[0], $data[1]); } @@ -40,7 +40,7 @@ public function denormalize(mixed $data, string $type, string $format = null, ar /** * @param array $data */ - public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool { return Location::class === $type; } diff --git a/src/Serializer/Normalizer/TimeWindowNormalizer.php b/src/Serializer/Normalizer/TimeWindowNormalizer.php index e45cc61..2c3b599 100644 --- a/src/Serializer/Normalizer/TimeWindowNormalizer.php +++ b/src/Serializer/Normalizer/TimeWindowNormalizer.php @@ -15,7 +15,7 @@ final class TimeWindowNormalizer implements NormalizerInterface /** * @param TimeWindowInterface $object */ - public function normalize(mixed $object, string $format = null, array $context = []): ?array + public function normalize(mixed $object, ?string $format = null, array $context = []): ?array { if ($object instanceof AbsoluteTimeWindow) { return [ @@ -37,7 +37,7 @@ public function normalize(mixed $object, string $format = null, array $context = /** * @param TimeWindowInterface $data */ - 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 TimeWindowInterface; } From 16f87a46f12cbc546caffcd8472aba0e293a670c Mon Sep 17 00:00:00 2001 From: Marco Wansinck Date: Tue, 16 Jun 2026 15:57:27 +0200 Subject: [PATCH 2/4] ci: test PHP 8.2-8.5 against Symfony 7.4/8.0/8.1 The matrix tested PHP 7.4-8.1 against Symfony 5.4/6.0, all of which the package no longer supports (composer.json already requires PHP ^8.2 and Symfony ^6.4|^7.0). Replace it with the currently supported range: - Symfony 7.4: PHP 8.2, 8.3, 8.4, 8.5 - Symfony 8.0/8.1: PHP 8.4, 8.5 (Symfony 8.x requires PHP >= 8.4) Also: - Allow Symfony 8 in composer.json (additive |^8.0, no BC break) - Bump php-cs-fixer job to PHP 8.2 (the supported floor) - actions/checkout@v2 -> v4, actions/cache@v4 - Replace removed ::set-output with $GITHUB_OUTPUT - Activate the symfony/flex plugin and use 'composer update' (no lock is committed) Verified locally: Symfony 7.4.10 and 8.1.0 both green (phpunit 3/3). --- .github/workflows/ci.yml | 32 ++++++++++++++++++++------------ composer.json | 12 ++++++------ 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9cef46e..2d417f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,12 +10,12 @@ jobs: fail-fast: false matrix: operating-system: [ ubuntu-latest ] - php-versions: [ '8.1' ] + php-versions: [ '8.2' ] runs-on: ubuntu-latest steps: # —— Github Checkout 🔎 —————————————————————————————————————————————————— - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -37,18 +37,25 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: [ '7.4', '8.0', '8.1' ] - symfony: [ '5.4', '6.0' ] + php-versions: [ '8.2', '8.3', '8.4', '8.5' ] + symfony: [ '7.4', '8.0', '8.1' ] exclude: - - php-versions: '7.4' - symfony: '6.0' + # Symfony 8.x requires PHP >= 8.4 + - php-versions: '8.2' + symfony: '8.0' + - php-versions: '8.3' + symfony: '8.0' + - php-versions: '8.2' + symfony: '8.1' + - php-versions: '8.3' + symfony: '8.1' runs-on: ${{ matrix.operating-system }} steps: # —— Git Checkout PR branch —————————————————————————————————————————— - name: Git Checkout PR branch (${{ github.ref }}) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -65,13 +72,13 @@ jobs: # —— Composer cache ———————————————————————————————————————————————————— - name: Get composer cache directory id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" - name: Cache composer dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ matrix.symfony }} restore-keys: ${{ runner.os }}-composer- # —— Install composer dependencies ————————————————————————————————————— @@ -79,9 +86,10 @@ jobs: env: COMPOSER_TOKEN: "${{ secrets.GITHUB_TOKEN }}" run: | - composer global require --no-interaction --no-progress symfony/flex:^1.11 + composer global config --no-plugins allow-plugins.symfony/flex true + composer global require --no-interaction --no-progress symfony/flex composer config extra.symfony.require "${{ matrix.symfony }}.*" - composer install --no-progress --no-scripts -q + composer update --no-progress --no-scripts # # —— PHPStan —————————————————————————————————————————————————————————— # - name: PHPStan (PHP Static Analysis) diff --git a/composer.json b/composer.json index a349b49..ead0dd0 100644 --- a/composer.json +++ b/composer.json @@ -14,17 +14,17 @@ "php": "^8.2", "ext-json": "*", "phpdocumentor/reflection-docblock": "^5.3", - "symfony/debug-bundle": "^6.4|^7.0", - "symfony/http-client": "^6.4|^7.0", - "symfony/property-access": "^6.4|^7.0", - "symfony/property-info": "^6.4|^7.0", - "symfony/serializer": "^6.4|^7.0" + "symfony/debug-bundle": "^6.4|^7.0|^8.0", + "symfony/http-client": "^6.4|^7.0|^8.0", + "symfony/property-access": "^6.4|^7.0|^8.0", + "symfony/property-info": "^6.4|^7.0|^8.0", + "symfony/serializer": "^6.4|^7.0|^8.0" }, "require-dev" : { "friendsofphp/php-cs-fixer": "^3.15", "phpstan/phpstan": "^1.8.7", "phpunit/phpunit": "^9.5|^10.0", - "symfony/var-dumper": "^6.4|^7.0" + "symfony/var-dumper": "^6.4|^7.0|^8.0" }, "autoload": { "psr-4": { From 822e8b78f2003ad0fb16fed1f9b84f8be77d01a4 Mon Sep 17 00:00:00 2001 From: Marco Wansinck Date: Tue, 16 Jun 2026 16:19:35 +0200 Subject: [PATCH 3/4] deps: require Symfony 7.4 LTS, drop EOL 7.0-7.3 Symfony 7.0-7.3 are out of maintenance; 7.4 is the LTS on the 7.x line. Narrow the constraint from ^7.0 to ^7.4 (6.4 LTS and 8.x kept). Constraints are now: ^6.4 (LTS) | ^7.4 (LTS) | ^8.0 (current). This matches the CI matrix, which already targets 7.4/8.0/8.1. --- composer.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index ead0dd0..6f35611 100644 --- a/composer.json +++ b/composer.json @@ -14,17 +14,17 @@ "php": "^8.2", "ext-json": "*", "phpdocumentor/reflection-docblock": "^5.3", - "symfony/debug-bundle": "^6.4|^7.0|^8.0", - "symfony/http-client": "^6.4|^7.0|^8.0", - "symfony/property-access": "^6.4|^7.0|^8.0", - "symfony/property-info": "^6.4|^7.0|^8.0", - "symfony/serializer": "^6.4|^7.0|^8.0" + "symfony/debug-bundle": "^6.4|^7.4|^8.0", + "symfony/http-client": "^6.4|^7.4|^8.0", + "symfony/property-access": "^6.4|^7.4|^8.0", + "symfony/property-info": "^6.4|^7.4|^8.0", + "symfony/serializer": "^6.4|^7.4|^8.0" }, "require-dev" : { "friendsofphp/php-cs-fixer": "^3.15", "phpstan/phpstan": "^1.8.7", "phpunit/phpunit": "^9.5|^10.0", - "symfony/var-dumper": "^6.4|^7.0|^8.0" + "symfony/var-dumper": "^6.4|^7.4|^8.0" }, "autoload": { "psr-4": { From 5e9d7d57df0a93e6090191250d3fa98624235443 Mon Sep 17 00:00:00 2001 From: Marco Wansinck Date: Tue, 16 Jun 2026 16:23:11 +0200 Subject: [PATCH 4/4] ci: add Symfony 6.4 LTS to the test matrix composer.json supports ^6.4 but CI did not exercise it. Add Symfony 6.4 across PHP 8.2-8.5 (6.4 supports PHP 8.1+; package floor is 8.2), closing the gap between the declared and tested support range. Verified locally: Symfony 6.4.37 green (phpunit 3/3). --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d417f2..08c9502 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: matrix: operating-system: [ubuntu-latest] php-versions: [ '8.2', '8.3', '8.4', '8.5' ] - symfony: [ '7.4', '8.0', '8.1' ] + symfony: [ '6.4', '7.4', '8.0', '8.1' ] exclude: # Symfony 8.x requires PHP >= 8.4 - php-versions: '8.2'