From 42140411ace7f05d81873d429242037267cae355 Mon Sep 17 00:00:00 2001 From: Theodore Brown Date: Sat, 22 Feb 2025 01:30:41 -0600 Subject: [PATCH] fix: deprecations in PHP 8.4 (#1119) * Fix implicitly nullable parameter deprecation in PHP 8.4 * Fix deprecation message for passing null to DateTime::createFromFormat() * Test on PHP 8.2, 8.3, and 8.4 * chore: Update README.md --------- Co-authored-by: Manisha Singh --- .github/workflows/test-and-deploy.yml | 2 +- CONTRIBUTING.md | 2 +- README.md | 2 +- lib/mail/Mail.php | 2 +- lib/stats/Stats.php | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 1ebe79195..151a01888 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 20 strategy: matrix: - php: [ '7.3', '7.4', '8.0', '8.1' ] + php: [ '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ] env: DOCKER_LOGIN: ${{ secrets.DOCKER_USERNAME && secrets.DOCKER_AUTH_TOKEN }} steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 37d2cb7c0..5df17e417 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ Please note that we utilize the [Gitflow Workflow](https://www.atlassian.com/git ##### Prerequisites ##### -- PHP version 7.3, 7.4, 8.0, or 8.1 +- PHP version 7.3+ ##### Initial setup: ##### diff --git a/README.md b/README.md index b28d16345..dd504a14d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ We appreciate your continued support, thank you! ## Prerequisites -- PHP version 7.3, 7.4, 8.0, or 8.1 +- PHP version 7.3+ - The Twilio SendGrid service, starting at the [free level](https://sendgrid.com/free?source=sendgrid-php) to send up to 40,000 emails for the first 30 days, then send 100 emails/day free forever or check out [our pricing](https://sendgrid.com/pricing?source=sendgrid-php). - For SMS messages, you will need a free [Twilio account](https://www.twilio.com/try-twilio?source=sendgrid-php). diff --git a/lib/mail/Mail.php b/lib/mail/Mail.php index c8511852a..3c1f446b8 100644 --- a/lib/mail/Mail.php +++ b/lib/mail/Mail.php @@ -101,7 +101,7 @@ public function __construct( $subject = null, $plainTextContent = null, $htmlContent = null, - array $globalSubstitutions = null + ?array $globalSubstitutions = null ) { if (!isset($from) && !isset($to) diff --git a/lib/stats/Stats.php b/lib/stats/Stats.php index 070816b23..6bcc27f82 100644 --- a/lib/stats/Stats.php +++ b/lib/stats/Stats.php @@ -189,15 +189,15 @@ public function getSubuserMonthly( } /** - * Validate the date format + * Validate YYYY-MM-DD date format * - * @param string $date YYYY-MM-DD + * @param string|null $date * * @throws Exception */ protected function validateDateFormat($date) { - if (false === DateTime::createFromFormat(self::DATE_FORMAT, $date)) { + if (is_null($date) || !DateTime::createFromFormat(self::DATE_FORMAT, $date)) { throw new Exception('Date must be in the YYYY-MM-DD format.'); } }