From e7263b5edbf9b1738f33ace01318090497fa5482 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Thu, 5 Sep 2024 15:46:59 +0545 Subject: [PATCH] Add PHP 8.4 compliance for v3 branch --- .github/workflows/ci.yml | 10 ++++++++-- .php-cs-fixer.dist.php | 4 ++++ composer.json | 6 +++--- lib/ContextStackTrait.php | 2 +- lib/Writer.php | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73f8983..19293e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,16 @@ jobs: matrix: php-versions: ['8.0', '8.1', '8.2', '8.3'] coverage: ['pcov'] + code-style: ['no'] code-analysis: ['no'] include: - php-versions: '7.4' coverage: 'none' + code-style: 'yes' + code-analysis: 'yes' + - php-versions: '8.4' + coverage: 'pcov' + code-style: 'no' code-analysis: 'yes' steps: - name: Checkout @@ -48,8 +54,8 @@ jobs: run: composer install --no-progress --prefer-dist --optimize-autoloader - name: Code Analysis (PHP CS-Fixer) - if: matrix.code-analysis == 'yes' - run: php vendor/bin/php-cs-fixer fix --dry-run --diff + if: matrix.code-style == 'yes' + run: PHP_CS_FIXER_IGNORE_ENV=true php vendor/bin/php-cs-fixer fix --dry-run --diff - name: Code Analysis (PHPStan) if: matrix.code-analysis == 'yes' diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 8fbc3c6..9f41283 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -11,6 +11,10 @@ $config->setRules([ '@PSR1' => true, '@Symfony' => true, + 'nullable_type_declaration' => [ + 'syntax' => 'question_mark', + ], + 'nullable_type_declaration_for_default_null_value' => true, ]); $config->setFinder($finder); diff --git a/composer.json b/composer.json index 936d991..7ecf386 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,8 @@ } }, "require-dev": { - "friendsofphp/php-cs-fixer": "^3.38", - "phpstan/phpstan": "^1.10", + "friendsofphp/php-cs-fixer": "^3.64", + "phpstan/phpstan": "^1.12", "phpunit/phpunit" : "^9.6" }, "scripts": { @@ -56,7 +56,7 @@ "phpstan analyse --generate-baseline phpstan-baseline.neon" ], "cs-fixer": [ - "php-cs-fixer fix" + "PHP_CS_FIXER_IGNORE_ENV=true php-cs-fixer fix" ], "phpunit": [ "phpunit --configuration tests/phpunit.xml" diff --git a/lib/ContextStackTrait.php b/lib/ContextStackTrait.php index 06c244d..e4933c6 100644 --- a/lib/ContextStackTrait.php +++ b/lib/ContextStackTrait.php @@ -110,7 +110,7 @@ public function popContext(): void $this->elementMap, $this->contextUri, $this->namespaceMap, - $this->classMap + $this->classMap, ) = array_pop($this->contextStack); } } diff --git a/lib/Writer.php b/lib/Writer.php index d431838..3dea023 100644 --- a/lib/Writer.php +++ b/lib/Writer.php @@ -235,7 +235,7 @@ public function writeAttribute($name, $value): bool list( $namespace, - $localName + $localName, ) = Service::parseClarkNotation($name); if (array_key_exists($namespace, $this->namespaceMap)) {