PHPCSStandards / composer-installer

Composer installer for PHP_CodeSniffer coding standards
https://packagist.org/packages/dealerdirect/phpcodesniffer-composer-installer
MIT License
549 stars 36 forks source link

Plugin is incompatible with Composer 2. #136

Closed glodov closed 3 years ago

glodov commented 3 years ago

I am trying to create a WordPress Coding Standard project: composer create-project wp-coding-standards/wpcs --no-dev

and getting an error:


    - Root composer.json requires dealerdirect/phpcodesniffer-composer-installer ^0.5 || ^0.6 -> satisfiable by dealerdirect/phpcodesniffer-composer-installer[v0.5.0, v0.6.0, v0.6.1, v0.6.2].```
jrfnl commented 3 years ago

This plugin is perfectly compatible with Composer 2.0. In fact, a version making it compatible was released over a year ago.

See the issue which has been pinned to the issue board for quite a while for a solution: #119

Potherca commented 3 years ago

TL;DR: You need to explicitly upgrade dealerdirect/phpcodesniffer-composer-installer to ^0.7

To quote the relevant part from #119 :

Composer treats minors below 1.0 as majors, so you need to explicitly upgrade your version constraints to allow for version 0.7.x of this plugin.

Version 0.7.0 was released last June and is fully ready for Composer 2.0, while also still supporting Composer 1.0. https://github.com/Dealerdirect/phpcodesniffer-composer-installer/releases/tag/v0.7.0

So: composer require --dev dealerdirect/phpcodesniffer-composer-installer:"^0.7.0" and your problem should be fixed.