name: "Check Coding Standards"

on:
  pull_request:

jobs:
  coding-standards:
    name: "Check Coding Standards"

    runs-on: ubuntu-latest

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

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: "7.4"
          tools: composer:v2, cs2pr

      - name: Install dependencies
        run: composer require squizlabs/php_codesniffer --no-interaction --no-progress

      - name: "Run phpcs"
        run: vendor/bin/phpcs -q --standard=PSR2 classes/ tests/ --report=checkstyle | cs2pr
