From 5e18cd3930ffa3876cfae0a1b47689aaae503585 Mon Sep 17 00:00:00 2001 From: Filippo Tessarotto Date: Wed, 4 Jan 2023 12:26:06 +0100 Subject: [PATCH] Add PHP 8.2 support --- .gitattributes | 19 ++++++++++--------- .github/workflows/integrate.yaml | 30 ++++++++++-------------------- Makefile | 3 ++- README.md | 1 - composer.json | 25 +++++++------------------ phpstan-baseline.neon | 5 +++++ tests/ErrorHandlerTest.php | 3 ++- 7 files changed, 36 insertions(+), 50 deletions(-) diff --git a/.gitattributes b/.gitattributes index d57d104..743ce33 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,9 +1,10 @@ -/.github export-ignore -/tests export-ignore -.gitattributes export-ignore -.gitignore export-ignore -.php-cs-fixer.php export-ignore -Makefile export-ignore -composer-require-checker.json export-ignore -phpstan.neon export-ignore -phpunit.xml export-ignore +/.github export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.php export-ignore +/Makefile export-ignore +/composer-require-checker.json export-ignore +/phpstan-baseline.neon export-ignore +/phpstan.neon export-ignore +/phpunit.xml export-ignore diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index b4431f1..8a56a98 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -33,7 +33,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: "Cache dependencies" - uses: actions/cache@v3.2.2 + uses: "actions/cache@v3" with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }} @@ -62,12 +62,12 @@ jobs: strategy: matrix: php-version: - - "8.1" + - "8.2" code-coverage: - - "pcov" - # include: - # - php-version: "8.1" - # code-coverage: "pcov" + - "none" + include: + - php-version: "8.1" + code-coverage: "pcov" steps: @@ -86,7 +86,7 @@ jobs: run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: "Cache dependencies" - uses: actions/cache@v3.2.2 + uses: "actions/cache@v3" with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }} @@ -105,14 +105,6 @@ jobs: timeout-minutes: 1 run: "vendor/bin/phpunit" - - name: "Send code coverage report to Codecov.io" - if: ${{ matrix.code-coverage != 'none' }} - uses: codecov/codecov-action@v3.1.1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./coverage/clover.xml - fail_ci_if_error: true - coding-standards: name: "Coding Standards" @@ -132,14 +124,13 @@ jobs: with: coverage: "none" php-version: "${{ matrix.php-version }}" - tools: cs2pr - name: "Get composer cache directory" id: composercache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: "Cache dependencies" - uses: actions/cache@v3.2.2 + uses: "actions/cache@v3" with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }} @@ -171,14 +162,13 @@ jobs: coverage: "none" php-version: "${{ matrix.php-version }}" ini-values: zend.assertions=1 - tools: cs2pr - name: "Get composer cache directory" id: composercache run: echo "::set-output name=dir::$(composer config cache-files-dir)" - name: "Cache dependencies" - uses: actions/cache@v3.2.2 + uses: "actions/cache@v3" with: path: ${{ steps.composercache.outputs.dir }} key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ matrix.dependencies }}-composer-${{ hashFiles('**/composer.json') }} @@ -188,4 +178,4 @@ jobs: run: "composer update --no-interaction --no-progress" - name: "Run static analysis" - run: "vendor/bin/phpstan analyse --no-progress" + run: "vendor/bin/phpstan analyse --no-progress --error-format=github" diff --git a/Makefile b/Makefile index 7aaa153..43345c2 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ all: csfix static-analysis test vendor: composer.json composer update + composer bump touch vendor .PHONY: csfix @@ -11,7 +12,7 @@ csfix: vendor .PHONY: static-analysis static-analysis: vendor - vendor/bin/phpstan analyse + php -d zend.assertions=1 vendor/bin/phpstan analyse .PHONY: test test: vendor diff --git a/README.md b/README.md index 026e4e0..e9205f4 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,5 @@ [![Latest Stable Version](https://img.shields.io/packagist/v/slam/php-errorhandler-legacy.svg)](https://packagist.org/packages/slam/php-errorhandler-legacy) [![Integrate](https://github.com/Slamdunk/php-errorhandler-legacy/workflows/Integrate/badge.svg?branch=master)](https://github.com/Slamdunk/php-errorhandler-legacy/actions) -[![Code Coverage](https://codecov.io/gh/Slamdunk/php-errorhandler-legacy/coverage.svg?branch=master)](https://codecov.io/gh/Slamdunk/php-errorhandler-legacy?branch=master) Crappy class to manage errors and exceptions diff --git a/composer.json b/composer.json index 694e9bd..529afa2 100644 --- a/composer.json +++ b/composer.json @@ -11,17 +11,16 @@ } ], "require": { - "php": "~8.1.0" + "php": "~8.1.0 || ~8.2.0" }, "require-dev": { - "malukenho/mcbumpface": "^1.1.5", - "phpstan/phpstan": "^1.8.2", - "phpstan/phpstan-phpunit": "^1.1.1", - "phpstan/phpstan-strict-rules": "^1.3.0", - "phpunit/phpunit": "^9.5.21", - "slam/php-cs-fixer-extensions": "^3.2.1", + "phpstan/phpstan": "^1.9.6", + "phpstan/phpstan-phpunit": "^1.3.3", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^9.5.27", + "slam/php-cs-fixer-extensions": "^3.3", "slam/php-debug-r": "^1.7.0", - "symfony/console": "^6.1.2" + "symfony/console": "^6.2.3" }, "autoload": { "psr-4": { @@ -32,15 +31,5 @@ "psr-4": { "SlamTest\\ErrorHandler\\": "tests/" } - }, - "config": { - "allow-plugins": { - "malukenho/mcbumpface": true - } - }, - "extra": { - "mc-bumpface": { - "stripVersionPrefixes": true - } } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 2b61af1..70297c6 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNotFalse\\(\\) with false will always evaluate to false\\.$#" + count: 1 + path: tests/ErrorHandlerTest.php + - message: "#^Expression \"\\$arrayPerVerificaErrori\\['undefined_index'\\]\" on a separate line does not do anything\\.$#" count: 1 diff --git a/tests/ErrorHandlerTest.php b/tests/ErrorHandlerTest.php index 5e434ef..097ce6b 100644 --- a/tests/ErrorHandlerTest.php +++ b/tests/ErrorHandlerTest.php @@ -80,6 +80,7 @@ public function testDefaultConfiguration(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testRegisterBuiltinHandlers(): void @@ -95,6 +96,7 @@ public function testRegisterBuiltinHandlers(): void /** * @runInSeparateProcess + * * @preserveGlobalState disabled */ public function testScream(): void @@ -225,7 +227,6 @@ public function testCanHideVariablesFromEmail(): void self::assertNotEmpty($this->emailsSent); $message = \current($this->emailsSent); - self::assertNotFalse($message); $messageText = $message['body']; self::assertStringContainsString($this->exception->getMessage(), $messageText);