From 9a8deceae661e9816dcfce814574d2b5fadb08f1 Mon Sep 17 00:00:00 2001 From: Alexander Veselov Date: Fri, 6 Oct 2023 17:53:42 +0300 Subject: [PATCH] SDK-4691: Added PHP 8.2 to CI check & unsupport PHP 7.4 (#50) --- .github/workflows/ci.yml | 10 ++++++++-- config/checkers.yaml | 2 +- src/Filesystem/Filesystem.php | 5 +++-- tests/Acceptance/Checker/PhpVersionCheckerTest.php | 4 ++-- tests/Acceptance/_data/ValidProject/deploy.dev.yml | 2 +- tests/Acceptance/_data/ValidProject/deploy.stag.yml | 3 ++- tests/Acceptance/_data/ValidProject/deploy.yml | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23f5580..d474c44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,8 @@ jobs: fail-fast: false matrix: php-version: [ - '7.4' + '7.4', + '8.2' ] steps: @@ -52,7 +53,12 @@ jobs: run: composer --version - name: Composer install - run: composer install + run: | + if [[ ${{ matrix.php-version }} == '8.2' ]]; then + composer update --prefer-stable --optimize-autoloader + else + composer install --optimize-autoloader + fi - name: Container lint run: bin/console lint:container diff --git a/config/checkers.yaml b/config/checkers.yaml index eb25023..6277293 100644 --- a/config/checkers.yaml +++ b/config/checkers.yaml @@ -1,6 +1,6 @@ parameters: # PHP version checker. Must be only major versions. Example: [5, 7, 8] - php_version_checker_allowed_php_major_versions: ['7', '8'] + php_version_checker_allowed_php_major_versions: ['8'] php_version_checker_sdk_php_major_versions: '%php_version_checker_allowed_php_major_versions%' php_version_checker_doc_url: https://docs.spryker.com/docs/scos/dev/guidelines/keeping-a-project-upgradable/upgradability-guidelines/php-version.html diff --git a/src/Filesystem/Filesystem.php b/src/Filesystem/Filesystem.php index d818d6a..10407ac 100644 --- a/src/Filesystem/Filesystem.php +++ b/src/Filesystem/Filesystem.php @@ -59,8 +59,9 @@ protected static function box(string $func, ...$args) } static::$lastError = null; - - set_error_handler([static::class, 'handleError']); + /** @var callable $callback */ + $callback = [static::class, 'handleError']; + set_error_handler($callback); try { return $func(...$args); } finally { diff --git a/tests/Acceptance/Checker/PhpVersionCheckerTest.php b/tests/Acceptance/Checker/PhpVersionCheckerTest.php index 24a0d02..e7d81c4 100644 --- a/tests/Acceptance/Checker/PhpVersionCheckerTest.php +++ b/tests/Acceptance/Checker/PhpVersionCheckerTest.php @@ -28,7 +28,7 @@ class PhpVersionCheckerTest extends ApplicationTestCase */ public function testReturnSuccessOnValidProject(): void { - $commandTester = $this->createCommandTester(TestHelper::VALID_PROJECT_PATH, ['PROJECT_PHP_VERSION' => '7.3.4']); + $commandTester = $this->createCommandTester(TestHelper::VALID_PROJECT_PATH, ['PROJECT_PHP_VERSION' => '8.1']); $commandTester->execute(['--checkers' => PhpVersionChecker::NAME]); $commandTester->assertCommandIsSuccessful(); @@ -66,7 +66,7 @@ public function testReturnViolationWhenProjectHasIssues(): void | 5 | Not all the targets have same PHP versions | Current php version $phpVersion: - | | | | tests/Acceptance/_data/InvalidProject/composer.json: - | | | | tests/Acceptance/_data/InvalidProject/deploy**.yml: - | - | | | SDK php versions: php7, php8 | + | | | SDK php versions: php8 | +---+-----------------------------------------------------------------------------+--------------------------------------------------------+ Read more: https://docs.spryker.com/docs/scos/dev/guidelines/keeping-a-project-upgradable/upgradability-guidelines/php-version.html diff --git a/tests/Acceptance/_data/ValidProject/deploy.dev.yml b/tests/Acceptance/_data/ValidProject/deploy.dev.yml index e626386..e6e91e2 100644 --- a/tests/Acceptance/_data/ValidProject/deploy.dev.yml +++ b/tests/Acceptance/_data/ValidProject/deploy.dev.yml @@ -5,7 +5,7 @@ tag: 'dev' environment: docker.dev image: - tag: spryker/php:7.4-alpine3.12 + tag: spryker/php:8.1-alpine3.12 php: enabled-extensions: - blackfire diff --git a/tests/Acceptance/_data/ValidProject/deploy.stag.yml b/tests/Acceptance/_data/ValidProject/deploy.stag.yml index 2e066d8..69bf160 100644 --- a/tests/Acceptance/_data/ValidProject/deploy.stag.yml +++ b/tests/Acceptance/_data/ValidProject/deploy.stag.yml @@ -4,7 +4,8 @@ namespace: spryker_b2c_dev tag: 'stag' environment: docker.staging -image: spryker/php:7.4-alpine3.12 +image: + tag: spryker/php:8.2-alpine3.12 composer: mode: '' diff --git a/tests/Acceptance/_data/ValidProject/deploy.yml b/tests/Acceptance/_data/ValidProject/deploy.yml index 35888ea..0981e56 100644 --- a/tests/Acceptance/_data/ValidProject/deploy.yml +++ b/tests/Acceptance/_data/ValidProject/deploy.yml @@ -5,7 +5,7 @@ tag: '1.0' environment: docker.production image: - tag: spryker/php:7.4-alpine3.12 + tag: spryker/php:8.0-alpine3.12 php: ini: "opcache.revalidate_freq": 0