From dd61663653d2169b20c7e27ea14491c803b784e2 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 7 Apr 2026 09:11:47 +0800 Subject: [PATCH 01/11] Remove union type declarations --- src/class-convertkit-api-traits.php | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/class-convertkit-api-traits.php b/src/class-convertkit-api-traits.php index 2c7f035..adf7ba0 100644 --- a/src/class-convertkit-api-traits.php +++ b/src/class-convertkit-api-traits.php @@ -144,7 +144,7 @@ public function get_email_stats() * * @return false|mixed */ - public function get_growth_stats(\DateTime|null $starting = null, \DateTime|null $ending = null) + public function get_growth_stats(?\DateTime $starting = null, ?\DateTime $ending = null) { return $this->get( 'account/growth_stats', @@ -344,10 +344,10 @@ public function add_subscriber_to_legacy_form(int $form_id, int $subscriber_id) public function get_form_subscriptions( int $form_id, string $subscriber_state = 'active', - \DateTime|null $created_after = null, - \DateTime|null $created_before = null, - \DateTime|null $added_after = null, - \DateTime|null $added_before = null, + ?\DateTime $created_after = null, + ?\DateTime $created_before = null, + ?\DateTime $added_after = null, + ?\DateTime $added_before = null, bool $include_total_count = false, string $after_cursor = '', string $before_cursor = '', @@ -471,10 +471,10 @@ public function add_subscriber_to_sequence(int $sequence_id, int $subscriber_id) public function get_sequence_subscriptions( int $sequence_id, string $subscriber_state = 'active', - \DateTime|null $created_after = null, - \DateTime|null $created_before = null, - \DateTime|null $added_after = null, - \DateTime|null $added_before = null, + ?\DateTime $created_after = null, + ?\DateTime $created_before = null, + ?\DateTime $added_after = null, + ?\DateTime $added_before = null, bool $include_total_count = false, string $after_cursor = '', string $before_cursor = '', @@ -737,10 +737,10 @@ public function remove_tag_from_subscriber_by_email(int $tag_id, string $email_a public function get_tag_subscriptions( int $tag_id, string $subscriber_state = 'active', - \DateTime|null $created_after = null, - \DateTime|null $created_before = null, - \DateTime|null $tagged_after = null, - \DateTime|null $tagged_before = null, + ?\DateTime $created_after = null, + ?\DateTime $created_before = null, + ?\DateTime $tagged_after = null, + ?\DateTime $tagged_before = null, bool $include_total_count = false, string $after_cursor = '', string $before_cursor = '', @@ -836,10 +836,10 @@ public function get_email_templates( public function get_subscribers( string $subscriber_state = 'active', string $email_address = '', - \DateTime|null $created_after = null, - \DateTime|null $created_before = null, - \DateTime|null $updated_after = null, - \DateTime|null $updated_before = null, + ?\DateTime $created_after = null, + ?\DateTime $created_before = null, + ?\DateTime $updated_after = null, + ?\DateTime $updated_before = null, string $sort_field = 'id', string $sort_order = 'desc', bool $include_total_count = false, @@ -1265,8 +1265,8 @@ public function create_broadcast( string $content = '', string $description = '', bool $public = false, - \DateTime|null $published_at = null, - \DateTime|null $send_at = null, + ?\DateTime $published_at = null, + ?\DateTime $send_at = null, string $email_address = '', string $email_template_id = '', string $thumbnail_alt = '', @@ -1437,8 +1437,8 @@ public function update_broadcast( string $content = '', string $description = '', bool $public = false, - \DateTime|null $published_at = null, - \DateTime|null $send_at = null, + ?\DateTime $published_at = null, + ?\DateTime $send_at = null, string $email_address = '', string $email_template_id = '', string $thumbnail_alt = '', @@ -1841,14 +1841,14 @@ public function create_purchase( string $transaction_id, array $products, string $currency = 'USD', - string|null $first_name = null, - string|null $status = null, + ?string $first_name = null, + ?string $status = null, float $subtotal = 0, float $tax = 0, float $shipping = 0, float $discount = 0, float $total = 0, - \DateTime|null $transaction_time = null + ?\DateTime $transaction_time = null ) { // Build parameters. $options = [ From c7c9c2901ad0011f1440156e08ff12bcaabdb144 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 7 Apr 2026 09:11:57 +0800 Subject: [PATCH 02/11] Run tests in PHP 7.4 --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c25d543..1401ee6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,7 @@ jobs: fail-fast: false matrix: wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] - php-versions: [ '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.4', '8.0', '8.1', '8.2' ] + php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.4', '8.0', '8.1', '8.2' ] # Steps to install, configure and run tests steps: From 8edce2df4e4d545b75b5aca8797523870d605796 Mon Sep 17 00:00:00 2001 From: Tim Carr Date: Tue, 7 Apr 2026 09:25:30 +0800 Subject: [PATCH 03/11] Add PHPCompatibilityWP to check code compat. with PHP 7.1+ --- .github/workflows/coding-standards.yml | 2 +- .github/workflows/tests.yml | 2 +- composer.json | 4 +++- phpcs.xml | 7 +++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 65be1c1..0997646 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -41,7 +41,7 @@ jobs: strategy: matrix: wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] - php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.3', '7.4', '8.0', '8.1' ] + php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.3', '7.4', '8.0', '8.1' ] # Steps to install, configure and run tests steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1401ee6..455580f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -50,7 +50,7 @@ jobs: fail-fast: false matrix: wp-versions: [ 'latest' ] #[ '6.1.1', 'latest' ] - php-versions: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.4', '8.0', '8.1', '8.2' ] + php-versions: [ '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] #[ '7.4', '8.0', '8.1', '8.2' ] # Steps to install, configure and run tests steps: diff --git a/composer.json b/composer.json index 94795b2..3c1ea2c 100644 --- a/composer.json +++ b/composer.json @@ -13,9 +13,11 @@ "require-dev": { "php-webdriver/webdriver": "^1.0", "wp-coding-standards/wpcs": "^3.0.0", + "phpcompatibility/phpcompatibility-wp": "^2.1", "phpstan/phpstan": "^1.0 || ^2.0", "szepeviktor/phpstan-wordpress": "^1.0 || ^2.0", - "lucatume/wp-browser": "^3.0 || ^4.0" + "lucatume/wp-browser": "^3.0 || ^4.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0" }, "minimum-stability": "stable", "scripts": { diff --git a/phpcs.xml b/phpcs.xml index 11ae28a..3708668 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -11,11 +11,14 @@ *.min.js - - class-convertkit-api-traits.php + + + + class-convertkit-api-traits.php + *.min.js - - + + class-convertkit-api-traits.php - - class-convertkit-api-traits.php -