Require parentheses for new() calls (even for anon. classes) #40
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Format (PHP) | |
on: | |
push: | |
paths: | |
- '**.php' | |
- 'composer.*' | |
- 'phpcs.xml' | |
- 'IxDFCodingStandard/ruleset.xml' | |
jobs: | |
format_php: | |
name: Format PHP | |
runs-on: ubuntu-latest | |
timeout-minutes: 7 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.2 | |
coverage: none | |
tools: cs2pr | |
- name: Get Composer cache directory | |
id: composer-cache | |
run: | | |
echo "composer_dir={$(composer config cache-files-dir)}" >> $GITHUB_OUTPUT | |
- name: Retrieve Composer‘s cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.composer-cache.outputs.composer_dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install composer dependencies | |
run: "composer install --no-interaction --no-progress --no-scripts" | |
- name: Retrieve PHPCS‘s cache | |
uses: actions/cache@v4 | |
with: | |
path: .cache/phpcs | |
key: ${{ runner.os }}-phpcs-${{ hashFiles('phpcs.xml') }} | |
restore-keys: | | |
${{ runner.os }}-phpcs- | |
- name: Detect PHP coding style issues | |
id: check_php_cs | |
run: composer cs:check | |
continue-on-error: true | |
- name: Fix detected PHP coding style issues (if any) | |
if: ${{ steps.check_php_cs.outcome == 'failure' }} | |
id: fix_php | |
run: composer cs:fix | |
continue-on-error: true | |
- name: Commit PHP code-style fixes (if any) | |
if: ${{ steps.check_php_cs.outcome == 'failure' }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "#15000 🪄️ Apply coding style fixes to PHP" | |
author_name: GitHub Actions | |
author_email: [email protected] | |
add: '*.php' | |
pull: '--rebase --autostash' | |
- name: Lint PHP coding style issues (if previously detected) | |
if: ${{ steps.check_php_cs.outcome == 'failure' }} | |
run: composer cs:check -- --report-full --report-checkstyle=./phpcs-report.xml | |
- name: Show PHPCS results in on GitHub UI | |
if: ${{ steps.check_php_cs.outcome == 'failure' }} | |
run: cs2pr ./phpcs-report.xml |