Skip to content

Commit

Permalink
Update for Composer 2.2 (#242)
Browse files Browse the repository at this point in the history
Using the `dealerdirect/phpcodesniffer-composer-installer` Composer plugin is recommended to register external PHPCS standards with PHPCS.

As of Composer 2.2.0, Composer plugins need to be explicitly allowed to run.

This commit:
* Adds the necessary configuration for that to the `composer.json` for this project.
* Adds the CLI command to set those permissions to the installation instructions for consumer projects.

Includes updating the URL references to the plugin to point to the new home of the plugin. (see [upstream issue #146](PHPCSStandards/composer-installer#146))

Refs:
* https://blog.packagist.com/composer-2-2/#more-secure-plugin-execution

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
  • Loading branch information
jrfnl and jrfnl authored Feb 21, 2022
1 parent 0c25aa9 commit c921498
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ VariableAnalysis requires PHP 5.4 or higher and [PHP CodeSniffer](https://github

This is the easiest method.

First, install [phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer) for your project if you have not already. This will also install PHPCS.
First, install [phpcodesniffer-composer-installer](https://github.com/PHPCSStandards/composer-installer) for your project if you have not already. This will also install PHPCS.

```
composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require --dev dealerdirect/phpcodesniffer-composer-installer
```

Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
"source": "https://github.com/sirbrillig/phpcs-variable-analysis"
},
"config": {
"sort-order": true
"sort-order": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit c921498

Please sign in to comment.