From cb4cdd643832105fb628de7b46f10a8c32437607 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 23 Feb 2023 13:09:18 +0400 Subject: [PATCH 1/2] Adds type checking --- .gitattributes | 1 + .github/workflows/static-analysis.yml | 42 +++++++++++++++++++++++++++ composer.json | 1 + phpstan.neon.dist | 6 ++++ 4 files changed, 50 insertions(+) create mode 100644 .github/workflows/static-analysis.yml create mode 100644 phpstan.neon.dist diff --git a/.gitattributes b/.gitattributes index 73c4f136..ca8cb283 100644 --- a/.gitattributes +++ b/.gitattributes @@ -13,5 +13,6 @@ .gitattributes export-ignore .gitignore export-ignore CHANGELOG.md export-ignore +phpstan.neon.dist export-ignore phpunit.xml.dist export-ignore UPGRADE.md export-ignore diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..0d677ea1 --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,42 @@ +name: static analysis + +on: + push: + branches: + - master + - '*.x' + pull_request: + +permissions: + contents: read + +jobs: + tests: + runs-on: ubuntu-22.04 + + strategy: + fail-fast: true + + name: Static Analysis + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.2 + tools: composer:v2 + coverage: none + extensions: redis + + - name: Install dependencies + uses: nick-fields/retry@v2 + with: + timeout_minutes: 5 + max_attempts: 5 + command: composer update --prefer-stable --prefer-dist --no-interaction --no-progress + + - name: Execute type checking + run: vendor/bin/phpstan diff --git a/composer.json b/composer.json index c2ca9aa4..da3022b3 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "require-dev": { "mockery/mockery": "^1.0", "orchestra/testbench": "^8.0", + "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^9.0" }, "autoload": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist new file mode 100644 index 00000000..70062030 --- /dev/null +++ b/phpstan.neon.dist @@ -0,0 +1,6 @@ +parameters: + paths: + - config + - src + + level: 0 From 25b46015451f0c26267ea95a6f24d05d5dd491d9 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Thu, 23 Feb 2023 13:16:47 +0400 Subject: [PATCH 2/2] Fixes usage of `predis` --- .github/workflows/static-analysis.yml | 1 - composer.json | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 0d677ea1..453d8a6a 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -29,7 +29,6 @@ jobs: php-version: 8.2 tools: composer:v2 coverage: none - extensions: redis - name: Install dependencies uses: nick-fields/retry@v2 diff --git a/composer.json b/composer.json index da3022b3..21a4f1b5 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,8 @@ "mockery/mockery": "^1.0", "orchestra/testbench": "^8.0", "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.0", + "predis/predis": "^2.1" }, "autoload": { "psr-4": {