diff --git a/.github/bootstrap-72.php b/.github/bootstrap-72.php new file mode 100644 index 00000000..ee8a0903 --- /dev/null +++ b/.github/bootstrap-72.php @@ -0,0 +1,3 @@ + tmp.json && mv tmp.json composer.json' - name: Commit PHP ${{ matrix.version }} version run: | git config user.email noreply@github.com && \ diff --git a/.github/workflows/tests-7.x.yaml b/.github/workflows/tests-7.x.yaml index 7e9a7232..d25ff147 100755 --- a/.github/workflows/tests-7.x.yaml +++ b/.github/workflows/tests-7.x.yaml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: ['7.3', '7.4'] + version: ['7.2', '7.3', '7.4'] steps: - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/transpile.yaml b/.github/workflows/transpile.yaml index 6db7508a..d3695a27 100755 --- a/.github/workflows/transpile.yaml +++ b/.github/workflows/transpile.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: ['7.3', '7.4', '8.0'] + version: ['7.2', '7.3', '7.4', '8.0'] steps: - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -23,8 +23,20 @@ jobs: run: composer install - name: Transpile to ${{ matrix.version }} run: php vendor/bin/rector process --no-diffs --no-progress-bar --config rector.$(echo ${{ matrix.version }} | sed -e 's/\.//').php src + - name: Add polyfill + if: matrix.version == '7.2' + run: composer require symfony/polyfill-php73 - name: Update composer.json version run: 'sed -i -e ''s/"php": "\^8.1"/"php": "\^${{ matrix.version }}"/'' composer.json' + - name: Downgrade phpunit + if: matrix.version == '7.2' + run: 'sed -i -e ''s/"phpunit\/phpunit": "\^9.5"/"phpunit\/phpunit": "\^8.5"/'' composer.json' + - name: Copy Bootstrap + if: matrix.version == '7.2' + run: cp .github/bootstrap-72.php src + - name: Load Bootstrap + if: matrix.version == '7.2' + run: 'cat composer.json | jq --argjson files ''["src/bootstrap-72.php"]'' ''.autoload += {files: $files}'' > tmp.json && mv tmp.json composer.json' - name: Update README run: sed -i '1s/^/# This branch is auto generated\n/' README.md - name: Commit PHP ${{ matrix.version }} version diff --git a/README.md b/README.md index b0465020..214794a5 100755 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ This implementation conforms to the official Unleash standards and implements al `composer require unleash/client` -Requires PHP 7.3 or newer. +Requires PHP 7.2 or newer. > You will also need some implementation of [PSR-18](https://packagist.org/providers/psr/http-client-implementation) > and [PSR-17](https://packagist.org/providers/psr/http-factory-implementation), for example diff --git a/rector.72.php b/rector.72.php new file mode 100644 index 00000000..9eb0d309 --- /dev/null +++ b/rector.72.php @@ -0,0 +1,11 @@ +import(DowngradeSetList::PHP_81); + $containerConfigurator->import(DowngradeSetList::PHP_80); + $containerConfigurator->import(DowngradeSetList::PHP_74); + $containerConfigurator->import(DowngradeSetList::PHP_73); +}; diff --git a/tests/DefaultUnleashTest.php b/tests/DefaultUnleashTest.php index d032f01c..a2237709 100755 --- a/tests/DefaultUnleashTest.php +++ b/tests/DefaultUnleashTest.php @@ -468,7 +468,7 @@ public function findFeature(string $featureName): ?Feature $this->cache[$featureName] = new DefaultFeature( $featureName, true, - new LimitIterator(new ArrayIterator([new DefaultStrategy('default')])), + new LimitIterator(new ArrayIterator([new DefaultStrategy('default')])) ); } diff --git a/tests/Strategy/GradualRolloutStrategyHandlerTest.php b/tests/Strategy/GradualRolloutStrategyHandlerTest.php index d8f7371d..097a0502 100755 --- a/tests/Strategy/GradualRolloutStrategyHandlerTest.php +++ b/tests/Strategy/GradualRolloutStrategyHandlerTest.php @@ -81,12 +81,12 @@ public function testIsEnabled() self::assertFalse($this->instance->isEnabled( $this->createStrategy(100, Stickiness::USER_ID), - new UnleashContext(), + new UnleashContext() )); self::assertFalse($this->instance->isEnabled( $this->createStrategy(100, Stickiness::USER_ID), - new UnleashContext(null, null, 'test'), + new UnleashContext(null, null, 'test') )); self::assertFalse( @@ -104,12 +104,12 @@ public function testIsEnabled() self::assertFalse($this->instance->isEnabled( $this->createStrategy(100, Stickiness::SESSION_ID), - new UnleashContext(), + new UnleashContext() )); self::assertFalse($this->instance->isEnabled( $this->createStrategy(100, Stickiness::SESSION_ID), - new UnleashContext('test'), + new UnleashContext('test') )); self::assertFalse( @@ -133,7 +133,7 @@ public function testIsEnabled() self::assertFalse($this->instance->isEnabled($strategy, new UnleashContext())); self::assertTrue($this->instance->isEnabled( $strategy, - (new UnleashContext())->setCustomProperty('something', 'test'), + (new UnleashContext())->setCustomProperty('something', 'test') )); $strategy = $this->createStrategy(100, Stickiness::DEFAULT, [ @@ -142,7 +142,7 @@ public function testIsEnabled() self::assertTrue($this->instance->isEnabled($strategy, new UnleashContext())); self::assertFalse($this->instance->isEnabled( $strategy, - (new UnleashContext())->setCustomProperty('something', 'test'), + (new UnleashContext())->setCustomProperty('something', 'test') )); }