shivammathur / setup-php

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.
https://setup-php.com
MIT License
2.85k stars 334 forks source link

phpcs tool install squizlabs version but PHPCSStandards is expected #809

Closed eclipxe13 closed 6 months ago

eclipxe13 commented 6 months ago

Describe the bug When installing the tool phpcs, it install old tool from squizlabs instead of new tool from PHPCSStandards. At the setup-php-action documentation page, it links phpcs to PHPCSStandards.

Version

Runners

Operating systems Ubuntu 22.04.3 LTS

PHP versions PHP 8.2 & PHP 8.3 (other versions are also affected)

To Reproduce

  phpcs:
    name: Code Style (phpcs)
    runs-on: "ubuntu-latest"
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.3'
          coverage: none
          tools: phpcs
        env:
          fail-fast: true
      - name: Display phpcs version
        run: phpcs --version

Expected behavior To install PHP_CodeSniffer version 3.8.0 (stable) by Squiz and PHPCSStandards

Are you willing to submit a PR? I've had check the source code but it looks like the tool already pointing to the right tool (from PHPCSStandards), but the installed version is different. I can try to make a PR but does not know what code to patch.

Workaround Install using phive or composer, like:

  phpcs:
    name: Code Style (phpcs)
    runs-on: "ubuntu-latest"
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '8.3'
          coverage: none
          tools: cs2pr, phive
        env:
          fail-fast: true
      - name: Install phpcs
        run: phive install phpcs --trust-gpg-keys 5E6DDE998AB73B8E
      - name: Code style (phpcs)
        run: tools/phpcs -q --report=checkstyle | cs2pr
shivammathur commented 6 months ago

It is updated in the develop branch, I will create a release this weekend

shivammathur commented 6 months ago

Released 2.29.0 with the change.