name: "PHPStan"

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

env:
  COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist"

jobs:
  phpstan:
    name: "PHPStan"

    runs-on: ubuntu-latest

    strategy:
      matrix:
        php-version:
          - "7.2"
          - "latest"

    steps:
      - name: "Checkout"
        uses: "actions/checkout@v4"

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          php-version: "${{ matrix.php-version }}"
          extensions: "intl, zip"
          ini-values: "memory_limit=-1"
          coverage: "none"

      - name: "Update dependencies"
        run: "composer update ${{ env.COMPOSER_FLAGS }}"

      - name: Run PHPStan
        run: |
          composer phpstan
