squizlabs / PHP_CodeSniffer

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

Reproducible installation method with PHAR files? #3815

Closed chrissound closed 1 year ago

chrissound commented 1 year ago

Describe the bug

Not really a bug... Installation methods do not provide a reproducible installation. I am also not sure how to build the PHAR files - which would also be a possible solution.

Basically about this:

# Or download using wget
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar

These files would likely point to the latest version which could potentially breaking something in future.

I've tried to clone down the repo and run the bin/phpcs file however that requires the whole project present:

~/.local/docker-cicd-build-env/bin/phpcs
PHP Warning:  include_once(PHP/CodeSniffer/autoload.php): failed to open stream: No such file or directory in /root/.local/docker-cicd-build-env/bin/phpcs on line 14

Is there a way I can download or build a PHAR with a specific version?

jrfnl commented 1 year ago

Installation methods do not provide a reproducible installation.

Well, that depends on which installation method you use, but the most common method of installation - via Composer - will allow you to "lock" to a specific version, so that should probably be your first choice.

Having said that....

Does that answer your question ?

chrissound commented 1 year ago

Thank you, that works great!