name: "Quality Control: PHP"

permissions:
  contents: read

on:
  workflow_call:
  workflow_dispatch:
  push:
    branches:
      - main
  schedule:
    - cron: "0 11 * * 2" # 11am Patch Tuesday

concurrency:
  group: ${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

jobs:
  php-stan:
    name: PHPStan
    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: 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