name: Tests

on:
  push:
  pull_request:

jobs:
  tests:
    name: "Tests"
    runs-on: ubuntu-latest

    strategy:
      matrix:
        php-version: ['8.1', '8.2', '8.3', '8.4']
        include:
          - { php-version: '8.1', dependencies: '--prefer-lowest' }

    steps:
      - uses: actions/checkout@v4

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-version }}
          coverage: xdebug

      - name: Install PHP dependencies
        run: composer update --no-interaction ${{ matrix.dependencies }}

      - name: Run tests
        run: vendor/bin/phpunit

      - name: Run PHPStan
        run: vendor/bin/phpstan
