PHPCSStandards / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
806 stars 47 forks source link

After installation still informs version from SquizLabs #112

Closed devdrops closed 7 months ago

devdrops commented 7 months ago

Describe the bug

I've executed the new installation in my project, php-toolbox with the instructions for this source, using Composer. However, when I run phpcs --version, the output still prints the SquizLabs message, as below:

image

~/.composer/vendor # which phpcs
/usr/local/bin/phpcs
~/.composer/vendor # phpcs --version
PHP_CodeSniffer version 3.7.2 (stable) by Squiz (http://www.squiz.net)
~/.composer/vendor # ls -lah /root/.composer/vendor/ | grep phpcsstandards
drwxr-xr-x    3 root     root        4.0K Dec  1 20:47 phpcsstandards
~/.composer/vendor # ls -lah /root/.composer/vendor/phpcsstandards/
total 12K
drwxr-xr-x    3 root     root        4.0K Dec  1 20:47 .
drwxr-xr-x   48 root     root        4.0K Dec  1 20:47 ..
drwxr-xr-x    5 root     root        4.0K Feb 22  2023 php_codesniffer

PS: If there is any path to fix this, I'm able to fork + PR :wink:

Code sample

N/A

Custom ruleset

N/A

To reproduce

Steps to reproduce the behavior:

  1. Install phpcs with the command below:
composer global require phpcsstandards/php_codesniffer
  1. Run phpcs --version.
  2. See output.
~/.composer/vendor # phpcs --version
PHP_CodeSniffer version 3.7.2 (stable) by Squiz (http://www.squiz.net)

Expected behavior

The output should write a message referring to this project.

Versions (please complete the following information)

Operating System Linux Alpine 3.18
PHP version 7.4, 8.0, 8.1, 8.2, 8.3
PHP_CodeSniffer version 3.7.2
Standard N/A
Install type Composer (global)

Additional context

N/A

Please confirm:

devdrops commented 7 months ago

Obs: as found in src/Config.php, lines 724 to 727:

case 'version':
    $output  = 'PHP_CodeSniffer version '.self::VERSION.' ('.self::STABILITY.') ';
    $output .= 'by Squiz (https://www.squiz.net)'.PHP_EOL;
    throw new DeepExitException($output, 0);
jrfnl commented 7 months ago

@devdrops I understand what you are saying, but the 3.7.2 version - even when pulled in from this repo is still the original release from Squiz. I'm not going to rewrite history, so while I have (re-)tagged all the old releases since the 2.0.0 release, to make it easier for people to switch over, they are 100% the same as the original releases.

Only once I've tagged a new release - the upcoming 3.8.0 version - will any changes from the move becomes visible. I mean, the 3.7.2 version, even when pulled from this repo, will still have the squizlabs/php_codesniffer name in the composer.json and won't have the replace directive yet. You can check it for yourself in your vendor directory.

I may change the version tag line (add "& PHPCSStandards"), but even if I do, it will still include the by Squiz as credit should go where credit is due and the package is still the PHP_CodeSniffer package.

As I said in the announcement:

Note: I would recommend waiting to make the switch until the 3.8.0 release has been tagged. Watch releases on the new repo to automatically get notified of this. The changelog will contain the relevant information for making the switch.

devdrops commented 7 months ago

Thank you for your response @jrfnl! I agree, makes total sense. I'll close this issue :wink: