From 6c885cb81ec22ee80e3cd0056a6350fafb822d61 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 15 Oct 2026 15:46:51 +0200 Subject: [PATCH] chore(php) #50 Use the PHP 8.3 to 8.5 functions through the Symfony polyfills, and configure Rector accordingly * Require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (cleverage/process-bundle#299) * Rector: PHP 8.2 instead of 8.5 (the minimum version of the bundle), withPhpSets() without argument to add the polyfills set, remove the redundant LevelSetList::UP_TO_PHP_82 * No code change: no Rector rule applies, no manual replacement keeps an identical behaviour * Document the PHP version rule in CONTRIBUTING.md, update CHANGELOG.md Co-Authored-By: Claude Opus 5.5 (1M context) --- CHANGELOG.md | 1 + CONTRIBUTING.md | 8 ++++++++ composer.json | 5 ++++- rector.php | 6 ++---- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eabba73..769718e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Latest ------ ### Changes +* [#50](https://github.com/cleverage/soap-process-bundle/issues/50) Require `symfony/polyfill-php83`, `symfony/polyfill-php84` and `symfony/polyfill-php85` ([cleverage/process-bundle#299](https://github.com/cleverage/process-bundle/issues/299)), so the functions of PHP 8.3 to 8.5 can be used while supporting PHP 8.2. Configure Rector for PHP 8.2 with its polyfills set (it was configured for PHP 8.5, and could introduce PHP 8.3+ functions without polyfill). No code change: no Rector rule applies and no manual replacement keeps an identical behaviour. Document it in `CONTRIBUTING.md`. * [#46](https://github.com/cleverage/soap-process-bundle/issues/46) Give a code to the task ([cleverage/process-bundle#91](https://github.com/cleverage/process-bundle/issues/91)): `soap_request` (`task: soap_request`, with `cleverage/process-bundle` 5.4 or later, referencing it by `service` being deprecated there). The task has its class name as service id; fetching it directly from the service container is deprecated (`container.private`), it will be private in 4.0. The former id `cleverage_soap_process.task.request` is a deprecated alias, removed in 4.0. Update documentation, add tests. * [#45](https://github.com/cleverage/soap-process-bundle/issues/45) Tag the `RequestTransformer` with its code, `soap_request`, for its lazy loading by `cleverage/process-bundle` 5.4 or later ([cleverage/process-bundle#276](https://github.com/cleverage/process-bundle/issues/276)). The transformer has its class name as service id; fetching it directly from the service container is deprecated (`container.private`), it will be private in 4.0. The former id `cleverage_soap_process.transformer.request` is a deprecated alias, removed in 4.0. Update documentation, add tests. * [#43](https://github.com/cleverage/soap-process-bundle/issues/43) CI: test the lowest versions allowed by `composer.json` (`--prefer-lowest`, PHP 8.2). Require `psr/log` `^2|^3`: the loggers (of the tests, and `TaskLogger` of `cleverage/process-bundle`) use the typed `LoggerInterface` signatures of `psr/log` 2+, a fatal error with `psr/log` 1. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9fb4f0a..ea1eb3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,6 +40,14 @@ make quality make tests ``` +## PHP version + +The bundle supports PHP 8.2 and later: do not use a syntax introduced by a later version (typed class constants, +property hooks, pipe operator...). The functions of PHP 8.3 to 8.5 (`json_validate()`, `array_find()`, `array_any()`, +`mb_trim()`, `array_first()`...) can be used: they are provided by the required `symfony/polyfill-php83`, +`symfony/polyfill-php84` and `symfony/polyfill-php85` packages on the older versions. Rector (`make quality`) is +configured accordingly. + ## Deprecations notices When a feature should be deprecated, or when you have a breaking change for a future version, please : diff --git a/composer.json b/composer.json index 92df28b..21b1fb6 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,10 @@ "symfony/dependency-injection": "^6.4|^7.4|^8", "symfony/finder": "^6.4|^7.4|^8", "symfony/http-kernel": "^6.4|^7.4|^8", - "symfony/options-resolver": "^6.4|^7.4|^8" + "symfony/options-resolver": "^6.4|^7.4|^8", + "symfony/polyfill-php83": "^1.33", + "symfony/polyfill-php84": "^1.33", + "symfony/polyfill-php85": "^1.33" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", diff --git a/rector.php b/rector.php index 7628528..a601b30 100644 --- a/rector.php +++ b/rector.php @@ -3,23 +3,21 @@ declare(strict_types=1); use Rector\Config\RectorConfig; -use Rector\Set\ValueObject\LevelSetList; use Rector\Symfony\Set\SymfonySetList; use Rector\ValueObject\PhpVersion; return RectorConfig::configure() - ->withPhpVersion(PhpVersion::PHP_85) + ->withPhpVersion(PhpVersion::PHP_82) ->withPaths([ __DIR__.'/src', __DIR__.'/tests', ]) - ->withPhpSets(php82: true) + ->withPhpSets() // here we can define, what prepared sets of rules will be applied ->withComposerBased(phpunit: true, symfony: true) ->withPreparedSets(deadCode: true, codeQuality: true, symfonyCodeQuality: true) ->withAttributesSets(symfony: true) ->withSets([ - LevelSetList::UP_TO_PHP_82, SymfonySetList::SYMFONY_CONSTRUCTOR_INJECTION, ]) ;