From 286e4361435fc0fa99c51234d01326695ecf10de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Thu, 4 Feb 2021 20:22:45 +0000 Subject: [PATCH] Run PHPStan only on PHP 7.1 --- .github/workflows/test.yml | 44 ++++++++++++++++++++++++++++++++++---- phpstan.neon | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 18dbe990a..e5fa1b009 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,10 +44,6 @@ jobs: run: | composer run-script phpcs - - name: PHP Static Analysis Tool - run: | - composer run-script phpstan -- --no-progress - - name: Unit tests run: | vendor/bin/phpunit -c phpunit.xml.dist @@ -71,3 +67,43 @@ jobs: vendor/bin/phpunit -c phpunit-integration-tests.xml env: TEST_SUITE: oss + + phpstan: + name: Static Analysis + runs-on: ${{ matrix.os }} + + strategy: + matrix: + php-version: [7.1] + os: [ubuntu-latest] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Use PHP ${{ matrix.php-version }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + tools: prestissimo + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Get composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: | + composer update --prefer-dist + + - name: PHP Static Analysis Tool + run: | + composer run-script phpstan -- --no-progress diff --git a/phpstan.neon b/phpstan.neon index c5f4cf5c4..8d54c3a7d 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,5 +6,6 @@ parameters: ignoreErrors: - '#^Unsafe usage of new static\(\)\.$#' # PHP 7.1 only + - '#^Constant JSON_THROW_ON_ERROR not found\.$#' - '#^Caught class JsonException not found\.$#' - '#^Call to method getCode\(\) on an unknown class JsonException\.$#'