diff --git a/CHANGELOG.md b/CHANGELOG.md index 463f323..8594dc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ Latest ------ ### Changes +* [#51](https://github.com/cleverage/cache-process-bundle/issues/51) Use the PHP 8.3 to 8.5 functions through the Symfony polyfills ([cleverage/process-bundle#299](https://github.com/cleverage/process-bundle/issues/299)): require `symfony/polyfill-php83`, `symfony/polyfill-php84` and `symfony/polyfill-php85`. Rector is configured with the minimum supported PHP version (`withPhpVersion(PhpVersion::PHP_82)`, it used PHP 8.5 features) and `withPhpSets()` without explicit version, which applies the rules using a newer function when its polyfill is required (no change on the current code). Document it in `CONTRIBUTING.md`. * [#49](https://github.com/cleverage/cache-process-bundle/issues/49) Add a `CleverAge\CacheProcessBundle\Registry\AdapterRegistry` alias of the `cleverage_cache_process.registry.adapter` service: the registry can be autowired, e.g. in a custom cache task extending `AbstractCacheTask`. Update documentation, add tests. * [#43](https://github.com/cleverage/cache-process-bundle/issues/43) Give a code to the tasks ([cleverage/process-bundle#91](https://github.com/cleverage/process-bundle/issues/91)): `cache_get` and `cache_set` (`task: cache_get`, with `cleverage/process-bundle` 5.4 or later, referencing them by `service` being deprecated there). The tasks have their class name as service id; fetching them directly from the service container is deprecated (`container.private`), they will be private in 3.0. The former ids `cleverage_cache_process.task.get` / `cleverage_cache_process.task.set` are deprecated aliases, removed in 3.0. Update documentation, add tests. * [#41](https://github.com/cleverage/cache-process-bundle/issues/41) CI: test the lowest versions allowed by `composer.json` (`--prefer-lowest`, PHP 8.2). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8222397..6bb568a 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 9dca794..4da4ee6 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,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 97b29e1..7406cc2 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, ]) ;