name: "Quality Control: PHP"

permissions:
  contents: read

on:
  workflow_call:
  workflow_dispatch:

jobs:
  php-stan:
    name: PHPStan
    runs-on: ${{ vars.RUNS_ON || 'ubuntu-latest' }}
    permissions:
      checks: write # To post annotations
      contents: read # For repo checkout
    steps:
      - uses: benzine-framework/action-setup-php@main
      - run: vendor/bin/phpstan analyse src

  php-cs-fixer:
    name: PHP-CS-Fixer
    runs-on: ${{ vars.RUNS_ON || 'ubuntu-latest' }}
    permissions:
      checks: write # For trunk to post annotations
      contents: read # For repo checkout
    steps:
      - uses: benzine-framework/action-setup-php@main
      - run: vendor/bin/php-cs-fixer fix --diff --verbose --dry-run