name: Static analysis

on:
  push:
  pull_request:

jobs:
  test:
    name: PHPStan
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false

    steps:
      - name: Check out code
        uses: actions/checkout@v4.1.6

      - name: Install PHP
        uses: shivammathur/setup-php@2.30.5
        with:
          php-version: '7.4'
          tools: composer:v2
          coverage: none

      - name: Install dependencies
        uses: nick-fields/retry@v3.0.0
        with:
          timeout_minutes: 5
          max_attempts: 5
          command: composer update --no-interaction --no-progress

      - name: Install PHPStan
        uses: nick-fields/retry@v3.0.0
        with:
          timeout_minutes: 5
          max_attempts: 5
          command: composer bin phpstan update --no-interaction --no-progress

      - name: Run static analysis
        run: make phpstan
