From a335032f86d8311f6912eef5330275512c1d4aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 18 Feb 2024 01:11:22 +0100 Subject: [PATCH] Enhancement: Add support for PHP 7.2 --- .github/settings.yml | 2 ++ .github/workflows/integrate.yaml | 12 +++++++++++- .php-cs-fixer.php | 2 +- CHANGELOG.md | 2 ++ composer.json | 4 ++-- composer.lock | 4 ++-- rector.php | 4 ++-- src/SystemClock.php | 2 +- test/Unit/SystemClockTest.php | 8 ++++---- 9 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/settings.yml b/.github/settings.yml index e684178..96cac90 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -21,6 +21,8 @@ branches: - context: "Refactoring (7.4, locked)" - context: "Security Analysis (7.4, locked)" - context: "Static Code Analysis (7.4, locked)" + - context: "Tests (7.2, highest)" + - context: "Tests (7.2, locked)" - context: "Tests (7.3, highest)" - context: "Tests (7.3, locked)" - context: "Tests (7.4, highest)" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 2a4ee82..a791f6b 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -429,6 +429,12 @@ jobs: - "highest" include: + - php-version: "7.2" + dependencies: "lowest" + + - php-version: "7.2" + dependencies: "highest" + - php-version: "7.3" dependencies: "lowest" @@ -471,7 +477,11 @@ jobs: - name: "Remove incompatible dependencies with composer" if: "matrix.dependencies != 'locked'" - run: "composer remove ergebnis/composer-normalize ergebnis/license ergebnis/php-cs-fixer-config infection/infection psalm/plugin-phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress" + run: "composer remove ergebnis/composer-normalize ergebnis/license ergebnis/php-cs-fixer-config infection/infection psalm/plugin-phpunit phpunit/phpunit vimeo/psalm --ansi --dev --no-interaction --no-progress" + + - name: "Require phpunit/phpunit" + if: "matrix.dependencies != 'locked'" + run: "composer require phpunit/phpunit:\"^8.5.19 || ^9.6.16\" --ansi --dev --no-interaction --no-progress" - name: "Install ${{ matrix.dependencies }} dependencies with composer" uses: "ergebnis/.github/actions/composer/install@1.9.0" diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 34e9db2..9a5bc50 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -26,7 +26,7 @@ $license->save(); -$ruleSet = PhpCsFixer\Config\RuleSet\Php73::create()->withHeader($license->header()); +$ruleSet = PhpCsFixer\Config\RuleSet\Php72::create()->withHeader($license->header()); $config = PhpCsFixer\Config\Factory::fromRuleSet($ruleSet); diff --git a/CHANGELOG.md b/CHANGELOG.md index c626b1b..28b2f85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ For a full diff see [`2.7.0...main`][2.7.0...main]. - Added support for PHP 8.0 ([#756]), by [@localheinz] - Added support for PHP 7.4 ([#757]), by [@localheinz] - Added support for PHP 7.3 ([#758]), by [@localheinz] +- Added support for PHP 7.2 ([#759]), by [@localheinz] ## [`2.7.0`][2.7.0] @@ -172,6 +173,7 @@ For a full diff see [`36912f6...1.0.0`][36912f6...1.0.0]. [#756]: https://github.com/ergebnis/clock/pull/756 [#757]: https://github.com/ergebnis/clock/pull/757 [#758]: https://github.com/ergebnis/clock/pull/758 +[#759]: https://github.com/ergebnis/clock/pull/759 [@ergebnis]: https://github.com/ergebnis [@localheinz]: https://github.com/localheinz diff --git a/composer.json b/composer.json index 22a90b7..f67979c 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "source": "https://github.com/ergebnis/clock" }, "require": { - "php": "~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", "psr/clock": "^1.0.0" }, "require-dev": { @@ -29,7 +29,7 @@ "ergebnis/license": "^2.4.0", "ergebnis/php-cs-fixer-config": "^6.22.0", "infection/infection": "~0.26.6", - "phpunit/phpunit": "^9.6.16", + "phpunit/phpunit": "^8.5.19 || ^9.6.16", "psalm/plugin-phpunit": "~0.18.4", "rector/rector": "^1.0.1", "vimeo/psalm": "^5.22.1" diff --git a/composer.lock b/composer.lock index 5a23734..40a19c3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4d433751752c1d96f7c07ce706d8df0e", + "content-hash": "48a0ec6e2bd77afe2bbd34fdf19ff686", "packages": [ { "name": "psr/clock", @@ -6324,7 +6324,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" + "php": "~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0" }, "platform-dev": [], "platform-overrides": { diff --git a/rector.php b/rector.php index f3689c9..44a668c 100644 --- a/rector.php +++ b/rector.php @@ -23,9 +23,9 @@ __DIR__ . '/test/', ]); - $rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_73); + $rectorConfig->phpVersion(ValueObject\PhpVersion::PHP_72); $rectorConfig->sets([ - PHPUnit\Set\PHPUnitSetList::PHPUNIT_90, + PHPUnit\Set\PHPUnitSetList::PHPUNIT_80, ]); }; diff --git a/src/SystemClock.php b/src/SystemClock.php index f09cc2d..2829ad6 100644 --- a/src/SystemClock.php +++ b/src/SystemClock.php @@ -26,7 +26,7 @@ public function now(): \DateTimeImmutable { return new \DateTimeImmutable( 'now', - $this->timezone, + $this->timezone ); } diff --git a/test/Unit/SystemClockTest.php b/test/Unit/SystemClockTest.php index 935daa6..f8cb28a 100644 --- a/test/Unit/SystemClockTest.php +++ b/test/Unit/SystemClockTest.php @@ -32,14 +32,14 @@ public function testNowReturnsCurrentDateTime(): void $before = new \DateTimeImmutable( 'now', - $timeZone, + $timeZone ); $now = $clock->now(); $after = new \DateTimeImmutable( 'now', - $timeZone, + $timeZone ); self::assertGreaterThanOrEqual($before, $now); @@ -54,14 +54,14 @@ public function testFreezeReturnsFrozenClock(): void $before = new \DateTimeImmutable( 'now', - $timeZone, + $timeZone ); $frozenClock = $clock->freeze(); $after = new \DateTimeImmutable( 'now', - $timeZone, + $timeZone ); self::assertInstanceOf(FrozenClock::class, $frozenClock);