Skip to content

#56 - Use the PHP 8.3 to 8.5 functions through the Symfony polyfills, and configure Rector accordingly - #57

Merged
njoubert-cleverage merged 1 commit into
mainfrom
56
Oct 15, 2026
Merged

njoubert-cleverage merged 1 commit into
mainfrom
56

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Fixes #56

Description

Same change as cleverage/process-bundle#299: the bundle supports PHP 8.2 and later, but Rector targeted PHP 8.5 (withPhpVersion(PhpVersion::PHP_85)) and could introduce PHP 8.3+ functions working on PHP 8.2 only thanks to transitively installed polyfills.

Changes

  • composer.json: require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (^1.33).
  • rector.php: withPhpVersion(PhpVersion::PHP_82) instead of PHP_85; withPhpSets() without argument (read from composer.json, adds Rector's PHP_POLYFILLS set: the rules using a newer function apply when its polyfill is required); remove the redundant LevelSetList::UP_TO_PHP_82 and its use.
  • Rector rules applied: none (vendor/bin/rector --dry-run reports no change with the new configuration).
  • Pre-existing uses of PHP 8.3 to 8.5 functions in src/ and tests/: none.
  • Manual analysis of src/: no replacement applies. Candidates reviewed and kept:
    • Client::constructUri() ltrim($url, '/'): an explicit character list, mb_ltrim() would bring nothing (and has different semantics: no .. ranges).
    • RegisterClientsPass::process() and CleverAgeRestProcessExtension::findServices() foreach: loops with side effects on every element, not a search / any / all (no array_find() / array_any() / array_all()).
    • Client::replaceParametersInUri() array_walk() / array_map() / array_values(): builds the replacement lists, no PHP 8.3+ function fits.
    • No reset() / current() / end() / key(), no json_decode() (the response body is output as a string), no ucfirst() / str_pad() in the code.
  • CONTRIBUTING.md: new "PHP version" section.
  • CHANGELOG.md: entry in the "Latest" section.

Checks

  • PHPUnit (highest, PHP 8.5): OK (33 tests, 105 assertions); with coverage (pcov), no risky test, 100% lines.
  • PHPUnit lowest (--prefer-lowest, PHP 8.2): OK (33 tests, 105 assertions), symfony/polyfill-php83/84/85 installed (v1.33.0).
  • PHPStan: no errors. PHP-CS-Fixer: 0 file fixed. Rector: no change.

Requirements

  • Documentation updates
    • Reference
    • Changelog
  • Unit tests

Breaking changes

None: three new small dependencies (polyfills), no change of the minimum PHP version.

🤖 Generated with Claude Code

…olyfills, and configure Rector accordingly

* Require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (cleverage/process-bundle#299)
* Rector: withPhpVersion(PHP_82) instead of PHP_85, withPhpSets() read from composer.json (adds the PHP_POLYFILLS set), remove the redundant LevelSetList::UP_TO_PHP_82
* No Rector rule applied, no manual replacement needed in the current code
* CONTRIBUTING: add a "PHP version" section
* Update CHANGELOG

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@njoubert-cleverage
njoubert-cleverage merged commit 539a6a8 into main Oct 15, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the PHP 8.3 to 8.5 functions through the Symfony polyfills, and configure Rector accordingly

1 participant