Skip to content

Require PHP 8.2 and support through PHP 8.5 - #135

Open
s3rgiosan wants to merge 2 commits into
developfrom
feature/php-8.2-8.5-support
Open

s3rgiosan wants to merge 2 commits into
developfrom
feature/php-8.2-8.5-support

Conversation

@s3rgiosan

Copy link
Copy Markdown
Member

Description of the Change

Raises the minimum PHP version to 8.2 and tests the plugin through PHP 8.5.

  • Minimum PHP is 8.2 in composer.json (with config.platform.php set to 8.2), the plugin header, readme.txt, and the README.
  • The PHPUnit workflow matrix covers PHP 8.2, 8.3, 8.4, and 8.5. WP_ENV_PHP_VERSION follows the matrix, so wp-env runs the suite on each version.
  • A new PHP Static Analysis workflow runs PHPCompatibilityWP (testVersion 8.2-8.5) and PHPStan (level 2, phpVersion 8.2 to 8.5). New Composer scripts: lint, lint:compat, phpstan.
  • Dev dependencies: 10up/phpcs-composer ^3.0.1, phpcompatibility/php-compatibility 10.0.0-alpha2, phpstan/phpstan ^2.1, szepeviktor/phpstan-wordpress ^2.0, phpunit/phpunit ^9.6. doctrine/instantiator is removed.
  • shivammathur/setup-php is bumped to v2.37.2 in the PHPUnit and E2E workflows.
  • Fixes found by PHPStan:
    • rest_prepare_{$post_type} is registered with add_filter, since prepare_links() returns the response.
    • The RelatedEntities docblocks type the relationship as PostToPost|PostToUser.
    • The @var annotations in DeletedItems name $p2u_table.

Closes #130

How to test the Change

  1. composer install
  2. composer lint:compat exits with no errors.
  3. composer phpstan reports no errors.
  4. WP_ENV_PHP_VERSION=8.5 npm run test:setup && npm run test:php passes. Repeat with 8.2.
  5. The PHPUnit (8.2 to 8.5), E2E, and PHP Static Analysis workflows pass on this PR.

Follow-ups

  • phpcompatibility/php-compatibility is pinned to 10.0.0-alpha2. Move to the stable 10.0.0 release once it ships.
  • PHPStan runs at level 2. Raising the level is tracked separately.
  • PHPUnit stays on 9.6. Upgrading to a newer major requires test and polyfill changes.

Changelog Entry

Added - PHPStan static analysis and a PHPCompatibility check for PHP 8.2 to 8.5, run in CI.
Changed - Bump minimum PHP version to 8.2 and test through PHP 8.5.
Changed - Update the PHPCS toolchain so the 10up ruleset and PHPCompatibilityWP sniffs install correctly.

Credits

Props @s3rgiosan

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@s3rgiosan s3rgiosan mentioned this pull request Sep 30, 2026
1 of 6 tasks
@jeffpaul jeffpaul added this to the 2.1.0 milestone Sep 30, 2026
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.

Update PHP support to 8.2–8.5

2 participants