From 3c745218373e4ab3662bf4bc17c923b711882d6a Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Fri, 18 Sep 2026 12:22:30 +0100 Subject: [PATCH 1/2] Declare PHP 7.4+ support and fix PHP 8.x deprecations Bump the plugin header's Requires PHP from 5.6 to 7.4 to match the existing composer.json constraint, add the missing Requires PHP line to readme.txt/README.md, wire up the already-installed PHPCompatibilityWP ruleset in phpcs (open-ended testVersion, no upper bound), expand the CI matrix to 7.4 through 8.5, and fix two PHP 8.x deprecations (implicitly-nullable typed params, dynamic property creation) while keeping PHP 7.4 compatibility. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/tests.yml | 2 +- .phpcs.xml.dist | 5 +++++ README.md | 2 ++ bin/readme.txt | 1 + inc/admin/namespace.php | 2 +- inc/class-scopes.php | 1 + inc/types/class-base.php | 2 +- plugin.php | 2 +- 8 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8be219f..5e7617a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.0', '8.1', '8.2', '8.3'] + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] wp: ['6.5', '6.6', '6.7', '6.8', '6.9'] steps: diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index ab5e57d..33a8326 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -29,4 +29,9 @@ + + + + + diff --git a/README.md b/README.md index 5950059..bde6b1f 100755 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ This plugin uses the OAuth 2 protocol to allow delegated authorization; that is, This plugin only supports WordPress >= 4.8. +Requires PHP 7.4 or higher. + ## Contributors Welcome! This plugin works and is in use in several production environments, but the user experience and documentation could be substantially improved. We welcome input and contributions to make this tool better! diff --git a/bin/readme.txt b/bin/readme.txt index 17b0d27..97db4bd 100644 --- a/bin/readme.txt +++ b/bin/readme.txt @@ -2,6 +2,7 @@ Contributors: rmccue, rachelbaker, danielbachhuber, joehoyle Tags: json, rest, api, rest-api Requires at least: 4.8 +Requires PHP: 7.4 Tested up to: 4.8 Stable tag: {{TAG}} License: GPLv2 or later diff --git a/inc/admin/namespace.php b/inc/admin/namespace.php index f72af1b..c1d0518 100644 --- a/inc/admin/namespace.php +++ b/inc/admin/namespace.php @@ -191,7 +191,7 @@ function validate_parameters( $params ) { * * @return array|null List of errors. Issues a redirect and exits on success. */ -function handle_edit_submit( Client $consumer = null ) { +function handle_edit_submit( ?Client $consumer = null ) { $messages = []; if ( empty( $consumer ) ) { $did_action = 'add'; diff --git a/inc/class-scopes.php b/inc/class-scopes.php index 36e8f75..087c1d3 100644 --- a/inc/class-scopes.php +++ b/inc/class-scopes.php @@ -9,6 +9,7 @@ class Scopes { protected $capabilities; + protected $scopes = []; public function __construct() { $this->capabilities = []; diff --git a/inc/types/class-base.php b/inc/types/class-base.php index d04031f..3c675b0 100644 --- a/inc/types/class-base.php +++ b/inc/types/class-base.php @@ -144,7 +144,7 @@ protected function validate_redirect_uri( Client $client, $redirect_uri = null ) * @param Client $client Client being authorised. * @param WP_Error $errors Errors to display, if any. */ - protected function render_form( Client $client, WP_Error $errors = null ) { + protected function render_form( Client $client, ?WP_Error $errors = null ) { $file = locate_template( 'oauth2-authorize.php' ); if ( empty( $file ) ) { $file = dirname( dirname( __DIR__ ) ) . '/theme/oauth2-authorize.php'; diff --git a/plugin.php b/plugin.php index 0d85d37..dfdc2d6 100644 --- a/plugin.php +++ b/plugin.php @@ -20,7 +20,7 @@ * Text Domain: oauth2 * Domain Path: /languages * Requires at least: 4.8 - * Requires PHP: 5.6 + * Requires PHP: 7.4 */ namespace WP\OAuth2; From 5f41f3bd5a02719a899f46d8c8aee4794b38dcb6 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Fri, 18 Sep 2026 13:20:43 +0100 Subject: [PATCH 2/2] Constrain composer PHP requirement to ^7.4 || ^8.0 Co-Authored-By: Claude Sonnet 5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c94b27d..90087d2 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ ], "require": { "composer/installers": "^1 || ^2", - "php": ">=7.4" + "php": "^7.4 || ^8.0" }, "require-dev": { "squizlabs/php_codesniffer": "^3.13.1",