Skip to content

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

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

njoubert-cleverage merged 1 commit into
mainfrom
164

Conversation

@njoubert-cleverage

Copy link
Copy Markdown
Member

Fixes #164

Description

Port of cleverage/process-bundle#299 (cleverage/process-bundle#300).

Changes

  • composer.json: require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (^1.33). No PHP 8.3+ function was used in src/ or tests/ before this PR (nothing relied on transitive polyfills).
  • rector.php: withPhpVersion(PhpVersion::PHP_82) (was PHP_85, which allowed Rector to introduce PHP 8.3+ functions without polyfill), withPhpSets() without argument (PHP version read from composer.json, plus Rector's PHP_POLYFILLS set: JsonValidateRector, ForeachToArrayAny/All/Find/FindKeyRector... apply when the matching polyfill is required), remove the redundant LevelSetList::UP_TO_PHP_82 and its use.
  • Rector rules applied: none, Rector (2.7.0, cache cleared) does not change the code.
  • Manual replacements: tests/DependencyInjection/CleverAgeUiProcessExtensionTest.php: end($calls) → array_last($calls) (non-empty list, internal pointer not used).
  • Rejected candidates (src/):
    • HttpProcessExecution::validateContext(): json_decode() → json_validate() rejected: the decoded value is used (it must be an array, a JSON scalar is rejected).
    • ProcessSchedule::getContext(), ProcessExecuteController: json_decode() reads the data.
    • No reset() / current() / key() / end() (the ->end() calls are methods), no foreach searching an element or testing any/all (the loops have side effects: collect messages, log, add schedules...), no ucfirst(mb_...) / trim() candidate.
  • Tests (lowest dependencies): requiring the polyfills changes the --prefer-lowest resolution: it now installs Doctrine ORM 2.20.0 (was ORM 3.6.0), whose legacy proxies cannot unset the readonly properties of the entities (Cannot unset readonly property ProcessExecution::$code from scope Proxies\__CG__\... in LogRecordCrudTest). The test kernel enables enable_lazy_ghost_objects with ORM 2, as the Symfony recipe of DoctrineBundle 2 does. Note: an application on ORM 2 without lazy ghost objects has the same problem (pre-existing, unrelated to this PR).
  • CONTRIBUTING.md: new "PHP version" section.
  • CHANGELOG.md: entry in "Latest".

Checks

  • PHPUnit, highest dependencies (PHP 8.5, Docker): OK (403 tests, 1239 assertions); with coverage (pcov): OK, no risky test, 91.57% lines.
  • PHPUnit, lowest dependencies (PHP 8.2, composer update --prefer-lowest, polyfills 1.33.0 installed): OK (403 tests, 2 deprecations from masterminds/html5, also on main). Without the test kernel change: 2 errors (see above).
  • PHPStan (--memory-limit=1G): no errors. PHP-CS-Fixer: no change. 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

…, and configure Rector accordingly

* Require symfony/polyfill-php83, symfony/polyfill-php84 and symfony/polyfill-php85 (^1.33).
* Rector: withPhpVersion(PHP_82) (was PHP_85) and withPhpSets() without argument (PHP_POLYFILLS set),
  remove the redundant LevelSetList::UP_TO_PHP_82. No change applied by Rector.
* array_last() instead of end() in CleverAgeUiProcessExtensionTest.
* Test kernel: lazy ghost proxies with Doctrine ORM 2, now installed by the lowest dependencies job
  (the legacy proxies cannot unset the readonly properties of the entities).
* CONTRIBUTING: new "PHP version" section. CHANGELOG.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@njoubert-cleverage
njoubert-cleverage merged commit a03a23d into main Oct 15, 2026
25 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