Skip to content

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

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

njoubert-cleverage merged 1 commit into
mainfrom
55

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Description

Fixes #55: use the functions of PHP 8.3 to 8.5 safely while supporting PHP 8.2, and align the Rector configuration with the minimum PHP version. Same change as cleverage/process-bundle#299.

Changes

  • composer.json: require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (^1.33). They are empty on the PHP versions having the functions natively.
  • rector.php:
    • withPhpVersion(PhpVersion::PHP_82) instead of PHP_85: no syntax above PHP 8.2;
    • withPhpSets() without explicit version (read from composer.json) instead of php81: true. This was a leftover: Upgrade to Symfony 7.3 & PHP 8.4 #20 (8464e81) configured Rector for PHP 8.1 when it was the minimum version, then Upgrade to Symfony 7.4 | 8.0 & PHP 8.5 #22 (6444aec) raised composer.json to "php": ">=8.2" without updating rector.php. The PHP 8.2 rules now apply as in the other bundles, and Rector adds its PHP_POLYFILLS set (the rules using a newer function apply when composer.json requires the matching symfony/polyfill-phpXX; an explicit version is a ceiling and skips them);
    • LevelSetList::UP_TO_PHP_82 removed (redundant with withPhpSets()).
  • Rector applied: no rule proposes a change on the current code (neither PHP 8.2 rules, e.g. no readonly class since all task classes have mutable properties, nor polyfill rules), so no BC-sensitive change had to be skipped.
  • Manual analysis (PHP 8.3 to 8.5 functions replacing existing code with an identical behaviour): none applied.
    • FileFetchTask::execute()/next() (current() / next() on $matchingFiles) and ListContentTask::execute()/next() (key() / current() / next() on $fsContent): not changed, the internal array pointer is actually used to iterate across execute()/next() calls, array_first()/array_key_first() would always return the first element.
    • The foreach loops of FileFetchTask::findMatchingFiles(), ListContentTask::getFilteredFilesystemContents() and RemoveFileTask::execute() filter or act on every item (they iterate Flysystem DirectoryListing objects, not arrays): no find/any/all pattern.
    • No json_decode, trim, ucfirst, str_pad usage.
  • Pre-existing uses of PHP 8.3+ functions in src/ and tests/: none.
  • CONTRIBUTING: new "PHP version" section (PHP 8.2 syntax, PHP 8.3 to 8.5 functions through the polyfills).
  • CHANGELOG (Latest).

Checks

  • 35 tests OK on PHP 8.5 (highest), also with coverage (pcov, no risky test, 100% lines).
  • 35 tests OK on PHP 8.2 with --prefer-lowest (the three polyfills installed).
  • PHPStan, PHP-CS-Fixer, Rector OK.

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 (^1.33)
- Rector: withPhpVersion(PHP_82) instead of PHP_85, withPhpSets() read from composer.json instead of the php81 leftover of #20 (also enables the polyfill rules), remove the redundant UP_TO_PHP_82 set; no change proposed on the current code
- CONTRIBUTING: document the PHP version policy
- CHANGELOG

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit 346fca8 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