PHPCSStandards / composer-installer

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

The composer plugin implementation seems to be breaking the composer lifecycle #49

Closed dalibor-matura closed 6 years ago

dalibor-matura commented 6 years ago

Problem

The dealerdirect/phpcodesniffer-composer-installer version 0.4.4 (currently latest version) is probably breaking composer lifecycle.

Here is a link to composer issue: https://github.com/composer/composer/issues/7298#issuecomment-393796348 where the Jordi Boggiano (the author of composer) and I have come to a conclusion that there may be a bug in this package.

Please, read the issue https://github.com/composer/composer/issues/7298, mainly the comment https://github.com/composer/composer/issues/7298#issuecomment-393796348, it contains all the details I was able to collect.

Expected behaviour

The composer update or composer require should not crash in the custom installer implemented by this package while trying to use autoloader that is not yet regenerated and is in a stale state (not updated yet).

dalibor-matura commented 6 years ago

This is still causing me problems on a couple of projects I'm working on.

Please, check out how it can be fixed or discuss a possible solution with composer maintainer (Jordi Boggiano).

Thanks a lot, Dalibor

stof commented 6 years ago

the culprit is https://github.com/Dealerdirect/phpcodesniffer-composer-installer/blob/2e41850d5f7797cbb1af7b030d245b3b24e63a08/src/Plugin.php#L121 which is running phpcs when initializing the plugin, and so expects the vendor folder to be in a working state at that time, including the dumped autoloader (which is not guaranteed at all by composer, almost the opposite)

jrfnl commented 6 years ago

Looks like PR #51 addresses this issue.

kenorb commented 6 years ago

Related GH-48

dalibor-matura commented 6 years ago

In order to use the fix from PR #51 commited to master branch, it would be good to get a new stable release.

Some of us needs to update the package with composer and latest master-dev is not allowed by restrictions of other dependent packages.

I've created a new issue with a request of new stable release #60

frenck commented 6 years ago

Merged in #51, I'll consider a release within the next couple of days (some cleanup on this repo in progress).