name: Static Analysis

on: ['push', 'pull_request']

jobs:
  phpstan:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        dependency-version: [prefer-lowest, 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
        coverage: none

    - name: Install Dependencies
      run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress --ansi

    - name: Run Style Tests
      run: composer test:lint

    - name: Run Types Tests
      run: composer test:types
