name: Static Analysis

on: ['push', 'pull_request']

jobs:
  phpstan:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        dependency-version: [prefer-stable]

    name: PHPStan ${{ matrix.dependency-version }}

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 8.1
          tools: composer:v2
          coverage: none

      - name: Install Dependencies
        run: composer update --prefer-stable --no-interaction --no-progress

      - name: Run PHPStan
        run: vendor/bin/phpstan analyse --no-progress
