Skip to content

Add PHP 8.4 Compatibility #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-versions: [ '8.0', '8.1', '8.2', '8.3' ]
php-versions: [ '8.0', '8.1', '8.2', '8.3', '8.4' ]

# Steps to install, configure and run tests
steps:
Expand Down
150 changes: 75 additions & 75 deletions src/ConvertKit_API_Traits.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,14 @@ public function get_email_stats()
/**
* Gets growth stats
*
* @param \DateTime $starting Gets stats for time period beginning on this date. Defaults to 90 days ago.
* @param \DateTime $ending Gets stats for time period ending on this date. Defaults to today.
* @param \DateTime|null $starting Gets stats for time period beginning on this date. Defaults to 90 days ago.
* @param \DateTime|null $ending Gets stats for time period ending on this date. Defaults to today.
*
* @see https://developers.convertkit.com/v4.html#get-growth-stats
*
* @return false|mixed
*/
public function get_growth_stats(\DateTime $starting = null, \DateTime $ending = null)
public function get_growth_stats(\DateTime|null $starting = null, \DateTime|null $ending = null)
{
return $this->get(
'account/growth_stats',
Expand Down Expand Up @@ -308,16 +308,16 @@ public function add_subscriber_to_form(int $form_id, int $subscriber_id, string
/**
* List subscribers for a form
*
* @param integer $form_id Form ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime $created_after Filter subscribers who have been created after this date.
* @param \DateTime $created_before Filter subscribers who have been created before this date.
* @param \DateTime $added_after Filter subscribers who have been added to the form after this date.
* @param \DateTime $added_before Filter subscribers who have been added to the form before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
* @param integer $form_id Form ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime|null $created_after Filter subscribers who have been created after this date.
* @param \DateTime|null $created_before Filter subscribers who have been created before this date.
* @param \DateTime|null $added_after Filter subscribers who have been added to the form after this date.
* @param \DateTime|null $added_before Filter subscribers who have been added to the form before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
*
* @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-form
*
Expand All @@ -326,10 +326,10 @@ public function add_subscriber_to_form(int $form_id, int $subscriber_id, string
public function get_form_subscriptions(
int $form_id,
string $subscriber_state = 'active',
\DateTime $created_after = null,
\DateTime $created_before = null,
\DateTime $added_after = null,
\DateTime $added_before = null,
\DateTime|null $created_after = null,
\DateTime|null $created_before = null,
\DateTime|null $added_after = null,
\DateTime|null $added_before = null,
bool $include_total_count = false,
string $after_cursor = '',
string $before_cursor = '',
Expand Down Expand Up @@ -435,16 +435,16 @@ public function add_subscriber_to_sequence(int $sequence_id, int $subscriber_id)
/**
* List subscribers for a sequence
*
* @param integer $sequence_id Sequence ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime $created_after Filter subscribers who have been created after this date.
* @param \DateTime $created_before Filter subscribers who have been created before this date.
* @param \DateTime $added_after Filter subscribers who have been added to the form after this date.
* @param \DateTime $added_before Filter subscribers who have been added to the form before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
* @param integer $sequence_id Sequence ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime|null $created_after Filter subscribers who have been created after this date.
* @param \DateTime|null $created_before Filter subscribers who have been created before this date.
* @param \DateTime|null $added_after Filter subscribers who have been added to the form after this date.
* @param \DateTime|null $added_before Filter subscribers who have been added to the form before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
*
* @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-sequence
*
Expand All @@ -453,10 +453,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 $created_after = null,
\DateTime $created_before = null,
\DateTime $added_after = null,
\DateTime $added_before = null,
\DateTime|null $created_after = null,
\DateTime|null $created_before = null,
\DateTime|null $added_after = null,
\DateTime|null $added_before = null,
bool $include_total_count = false,
string $after_cursor = '',
string $before_cursor = '',
Expand Down Expand Up @@ -651,16 +651,16 @@ public function remove_tag_from_subscriber_by_email(int $tag_id, string $email_a
/**
* List subscribers for a tag
*
* @param integer $tag_id Tag ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime $created_after Filter subscribers who have been created after this date.
* @param \DateTime $created_before Filter subscribers who have been created before this date.
* @param \DateTime $tagged_after Filter subscribers who have been tagged after this date.
* @param \DateTime $tagged_before Filter subscribers who have been tagged before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
* @param integer $tag_id Tag ID.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param \DateTime|null $created_after Filter subscribers who have been created after this date.
* @param \DateTime|null $created_before Filter subscribers who have been created before this date.
* @param \DateTime|null $tagged_after Filter subscribers who have been tagged after this date.
* @param \DateTime|null $tagged_before Filter subscribers who have been tagged before this date.
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
*
* @see https://developers.convertkit.com/v4.html#list-subscribers-for-a-tag
*
Expand All @@ -669,10 +669,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 $created_after = null,
\DateTime $created_before = null,
\DateTime $tagged_after = null,
\DateTime $tagged_before = null,
\DateTime|null $created_after = null,
\DateTime|null $created_before = null,
\DateTime|null $tagged_after = null,
\DateTime|null $tagged_before = null,
bool $include_total_count = false,
string $after_cursor = '',
string $before_cursor = '',
Expand Down Expand Up @@ -746,18 +746,18 @@ public function get_email_templates(
/**
* List subscribers.
*
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param string $email_address Search susbcribers by email address. This is an exact match search.
* @param \DateTime $created_after Filter subscribers who have been created after this date.
* @param \DateTime $created_before Filter subscribers who have been created before this date.
* @param \DateTime $updated_after Filter subscribers who have been updated after this date.
* @param \DateTime $updated_before Filter subscribers who have been updated before this date.
* @param string $sort_field Sort Field (id|updated_at|cancelled_at).
* @param string $sort_order Sort Order (asc|desc).
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
* @param string $subscriber_state Subscriber State (active|bounced|cancelled|complained|inactive).
* @param string $email_address Search susbcribers by email address. This is an exact match search.
* @param \DateTime|null $created_after Filter subscribers who have been created after this date.
* @param \DateTime|null $created_before Filter subscribers who have been created before this date.
* @param \DateTime|null $updated_after Filter subscribers who have been updated after this date.
* @param \DateTime|null $updated_before Filter subscribers who have been updated before this date.
* @param string $sort_field Sort Field (id|updated_at|cancelled_at).
* @param string $sort_order Sort Order (asc|desc).
* @param boolean $include_total_count To include the total count of records in the response, use true.
* @param string $after_cursor Return results after the given pagination cursor.
* @param string $before_cursor Return results before the given pagination cursor.
* @param integer $per_page Number of results to return.
*
* @since 2.0.0
*
Expand All @@ -768,10 +768,10 @@ public function get_email_templates(
public function get_subscribers(
string $subscriber_state = 'active',
string $email_address = '',
\DateTime $created_after = null,
\DateTime $created_before = null,
\DateTime $updated_after = null,
\DateTime $updated_before = null,
\DateTime|null $created_after = null,
\DateTime|null $created_before = null,
\DateTime|null $updated_after = null,
\DateTime|null $updated_before = null,
string $sort_field = 'id',
string $sort_order = 'desc',
bool $include_total_count = false,
Expand Down Expand Up @@ -1090,9 +1090,9 @@ public function get_broadcasts(
* @param string $content The broadcast's email HTML content.
* @param string $description An internal description of this broadcast.
* @param boolean $public Specifies whether or not this is a public post.
* @param \DateTime $published_at Specifies the time that this post was published (applicable
* @param \DateTime|null $published_at Specifies the time that this post was published (applicable
* only to public posts).
* @param \DateTime $send_at Time that this broadcast should be sent; leave blank to create
* @param \DateTime|null $send_at Time that this broadcast should be sent; leave blank to create
* a draft broadcast. If set to a future time, this is the time that
* the broadcast will be scheduled to send.
* @param string $email_address Sending email address; leave blank to use your account's
Expand All @@ -1115,8 +1115,8 @@ public function create_broadcast(
string $content = '',
string $description = '',
bool $public = false,
\DateTime $published_at = null,
\DateTime $send_at = null,
\DateTime|null $published_at = null,
\DateTime|null $send_at = null,
string $email_address = '',
string $email_template_id = '',
string $thumbnail_alt = '',
Expand Down Expand Up @@ -1197,9 +1197,9 @@ public function get_broadcast_stats(int $id)
* @param string $content The broadcast's email HTML content.
* @param string $description An internal description of this broadcast.
* @param boolean $public Specifies whether or not this is a public post.
* @param \DateTime $published_at Specifies the time that this post was published (applicable
* @param \DateTime|null $published_at Specifies the time that this post was published (applicable
* only to public posts).
* @param \DateTime $send_at Time that this broadcast should be sent; leave blank to create
* @param \DateTime|null $send_at Time that this broadcast should be sent; leave blank to create
* a draft broadcast. If set to a future time, this is the time that
* the broadcast will be scheduled to send.
* @param string $email_address Sending email address; leave blank to use your account's
Expand All @@ -1223,8 +1223,8 @@ public function update_broadcast(
string $content = '',
string $description = '',
bool $public = false,
\DateTime $published_at = null,
\DateTime $send_at = null,
\DateTime|null $published_at = null,
\DateTime|null $send_at = null,
string $email_address = '',
string $email_template_id = '',
string $thumbnail_alt = '',
Expand Down Expand Up @@ -1588,14 +1588,14 @@ public function get_purchase(int $purchase_id)
* @param string $transaction_id Transaction ID.
* @param array<string,int|float|string> $products Products.
* @param string $currency ISO Currency Code.
* @param string $first_name First Name.
* @param string $status Order Status.
* @param string|null $first_name First Name.
* @param string|null $status Order Status.
* @param float $subtotal Subtotal.
* @param float $tax Tax.
* @param float $shipping Shipping.
* @param float $discount Discount.
* @param float $total Total.
* @param \DateTime $transaction_time Transaction date and time.
* @param \DateTime|null $transaction_time Transaction date and time.
*
* @see https://developers.convertkit.com/v4.html#create-a-purchase
*
Expand All @@ -1606,14 +1606,14 @@ public function create_purchase(
string $transaction_id,
array $products,
string $currency = 'USD',
string $first_name = null,
string $status = null,
string|null $first_name = null,
string|null $status = null,
float $subtotal = 0,
float $tax = 0,
float $shipping = 0,
float $discount = 0,
float $total = 0,
\DateTime $transaction_time = null
\DateTime|null $transaction_time = null
) {
// Build parameters.
$options = [
Expand Down