name: Static Analysis
on: [push, pull_request]
jobs:
  paypal:
    name: PHP ${{ matrix.php-versions }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        php-versions: ['8.2', '8.3', '8.4', '8.5']
    steps:
    - name: Checkout
      uses: actions/checkout@v5
    - name: Setup PHP with Composer and extensions
      with:
        php-version: ${{ matrix.php-versions }}
      uses: shivammathur/setup-php@v2
    - name: Get Composer cache directory
      id: composercache
      run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
    - name: Cache Composer dependencies
      uses: actions/cache@v5
      with:
        path: ${{ steps.composercache.outputs.dir }}
        key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
        restore-keys: ${{ runner.os }}-composer-
    - name: Install Composer dependencies
      run: composer install --no-progress --prefer-dist --optimize-autoloader
    - name: Run type checking analysis
      env:
        PHP_VERSION: ${{ matrix.php-versions }}
      run: vendor/bin/phpstan
