From 765ca06ac7ce2e4690c830ab53eb3e737982e740 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pollesch?= Date: Wed, 1 Nov 2023 10:22:30 +0100 Subject: [PATCH] Updates for PHPUnit 10 and PHP 7.4/8.0 deprecations --- .github/workflows/ci.yml | 4 ++-- composer.json | 4 ++-- phpunit.xml.dist | 13 +++++++------ src/Cron/CronExpression.php | 13 ++++++------- tests/Cron/CronExpressionTest.php | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5347a..b13a1a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: ['7.4', '8.0', '8.1', '8.2'] + php-version: ['8.1', '8.2', '8.3'] steps: - uses: actions/checkout@v3 @@ -17,7 +17,7 @@ jobs: - name: PHPUnit Tests uses: php-actions/phpunit@master with: - version: 9.6 + version: 10 bootstrap: vendor/autoload.php configuration: phpunit.xml.dist args: --coverage-text diff --git a/composer.json b/composer.json index 52f8307..0dca546 100644 --- a/composer.json +++ b/composer.json @@ -11,10 +11,10 @@ } ], "require": { - "php": "7.4.* || 8.0.* || 8.1.* || 8.2.*" + "php": "8.1.* || 8.2.* || 8.3.*" }, "require-dev": { - "phpunit/phpunit": "~9.0" + "phpunit/phpunit": "~10.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5e72030..a300433 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,14 @@ - - - - src - - + + tests + + + src + + diff --git a/src/Cron/CronExpression.php b/src/Cron/CronExpression.php index ce58095..01a127e 100644 --- a/src/Cron/CronExpression.php +++ b/src/Cron/CronExpression.php @@ -77,20 +77,19 @@ class CronExpression ]; /** - * Time zone - * * @var DateTimeZone|null */ - protected $timeZone = null; + protected readonly ?DateTimeZone $timeZone; /** - * Matching registers - * * @var array|null */ - protected $registers = null; + protected readonly ?array $registers; - protected $expression; + /** + * @var string + */ + protected readonly string $expression; /** * @param string $expression a cron expression, e.g. "* * * * *" diff --git a/tests/Cron/CronExpressionTest.php b/tests/Cron/CronExpressionTest.php index 1b61c2e..e4152fe 100644 --- a/tests/Cron/CronExpressionTest.php +++ b/tests/Cron/CronExpressionTest.php @@ -33,7 +33,7 @@ public function testParser(string $expression, bool $valid = false, string $when /** * @return array */ - public function parserTestProvider() + public static function parserTestProvider() { return [ ["* * * * *", true, 'now', true], @@ -163,7 +163,7 @@ public function testGetNext(string $expression, int $timestampCurrent, int $time /** * @return array */ - public function getNextProvider() + public static function getNextProvider() { return [ ['* * 13 * fri', 1400407467, 1402610400],