name: PHPStan

on:
  pull_request:
  push:
    branches:
      - 1.x
      - 2.x

jobs:
  phpstan:
    runs-on: ubuntu-20.04
    steps:
      - name: Checkout
        uses: actions/checkout@v3

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

      - name: Update project dependencies
        uses: ramsey/composer-install@v2

      - name: Add vips
        run: composer require rokka/imagine-vips

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