name: "Coding Styles"

on: push

jobs:
    tests:
        name: Coding Styles
        runs-on: ubuntu-latest

        strategy:
            fail-fast: true
            matrix:
                php:
                    - 8.4

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

            -   name: Install PHP
                uses: shivammathur/setup-php@v2
                with:
                    php-version: ${{ matrix.php }}
                    coverage: xdebug
                    ini-values: memory_limit=1G
                    tools: cs2pr

            -   name: Validate Composer files
                run: composer validate --no-check-all --strict

            -   name: Install Composer dependencies
                run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader

            -   name: Coding styles
                run: php vendor/bin/php-cs-fixer fix --verbose --dry-run --format=checkstyle | cs2pr
