feat: support PHP 8.1 - #60
Merged
Merged
Conversation
Downshift the minimum PHP requirement from 8.2 to 8.1. The source code itself has no 8.2-specific syntax — the previous 8.2 floor was purely an accident of the lockfile: composer had resolved symfony/* to 7.x (which requires 8.2) even though composer.json only asks for ^6.0. Changes: - composer.json: add "php": "^8.1" to require, and pin config.platform.php = 8.1.0 so future lockfile regens stay compatible. - composer.lock: regenerated against the 8.1 platform — symfony/* drops to the 6.4 LTS line, chrome-php/chrome to 1.16.1, phpunit to 10.5.64. - .github/workflows/tests.yml: add 8.1 back to the matrix. Rationale: PrestaShop 8.x still runs on PHP 8.1, so widening support matches real-world PrestaShop installs. Note: symfony 6.4 reaches EOL in November 2027 — at that point we'll need to bump back to 8.2+ to move to symfony 7.x. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Constants in traits require PHP 8.2+. Traits\Version had a SUPPORTED_VERSIONS const used only internally (self::SUPPORTED_VERSIONS on a single line, no external references). Converting it to a private static array preserves the "shared list at the top of the file" readability while restoring PHP 8.1 compatibility. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Same PHP 8.1 constraint as Traits\Version: constants cannot live inside a trait before PHP 8.2. The Output trait held ten public constants (state markers PASS/FAIL/… and output modes) referenced from three places: internally via self::PASS, and externally in TestsSuite and ExecuteSuite via self::OUTPUT_* — both of which relied on the trait injecting the constants onto the using class. Move the constants into a new OutputStates interface and have TestsSuite / ExecuteSuite implement it. self::PASS inside the trait still resolves because a trait's self:: binds to the using class, and that class now inherits the constants through the interface. All external self::OUTPUT_* references keep working unchanged. Also fully qualified: PrestaFlow\Library\Utils\OutputStates. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contexte
Suite à l'investigation menée après la mise en place de la CI (#59) : le blocage sur PHP 8.2+ n'était pas dû au code de la lib mais à un lockfile qui avait résolu
symfony/*en 7.x (qui exige PHP 8.2) alors quecomposer.jsondéclaresymfony/* ^6.0. Aucune syntaxe 8.2+ n'est utilisée danssrc/.PrestaShop 8.x tourne encore sur PHP 8.1, donc supporter cette version élargit la couverture réelle des utilisateurs de la lib.
Changements
composer.jsonrequire:"php": "^8.1".config.platform.php = 8.1.0pour que toute regen future du lock reste compatible 8.1.composer.lock— regénéré :symfony/*: 7.3.x → 6.4 LTS (event-dispatcher, filesystem, process, string, console, etc.)chrome-php/chrome: 1.14.0 → 1.16.1phpunit/phpunit: 10.5.63 → 10.5.64.github/workflows/tests.yml— remet8.1dans la matrice →['8.1', '8.2', '8.3', '8.4'].Vérification locale
À faire en suivant (hors PR)
Point de vigilance
Symfony 6.4 atteint son EOL en novembre 2027. Il faudra alors bumper à nouveau à PHP 8.2+ pour passer à Symfony 7.x. Un rappel en commentaire dans le commit message.
Ce qui n'a pas été fait
PHP 8.0 — investigué mais bloqué par
sapientpro/image-comparator ^1.0(PHP ^8.1) etphpunit ^10(PHP 8.1+), sans version de rechange raisonnable. PHP 8.0 est de toute façon en fin de vie.🤖 Generated with Claude Code