inpsyde / wp-translation-downloader

Composer plugin to download WordPress translations
MIT License
45 stars 3 forks source link

Fatal error during installation with Composer 2 #8

Closed stian-overasen closed 3 years ago

stian-overasen commented 3 years ago

The ZipDownloader you're using in Plugin.php is missing a required argument for Composer 2. This causes a fatal php error during installation.

https://github.com/inpsyde/wp-translation-downloader/blob/033beca1451b233cfdd24073cf3b33977dd4e018/src/Plugin.php#L132

PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function Composer\Downloader\FileDownloader::__construct(), 2 passed in /Users/x/Sites/x/app/public/vendor/inpsyde/wp-translation-downloader/src/Plugin.php on line 132 and at least 3 expected in phar:///usr/local/Cellar/composer/2.0.2/bin/composer/src/Composer/Downloader/FileDownloader.php:77

Chrico commented 3 years ago

Thanks, i see, that the ZipDownloader - or better said the FileDownloader needs in v2 an instance of HttpDownloader - while on v1 this was not there. I need to see, if i can detect the version of Composer currently used and injecting it depending on the version.

It seems thats a breaking change which i couldn't find any information about it in UPGRADE-2.0.md.

Chrico commented 3 years ago

Just a quick feedback: I started to work on an own branch "composer-v2" https://github.com/inpsyde/wp-translation-downloader/tree/composer-v2 which will also remove compatibility to Composer v1.

Chrico commented 3 years ago

@stian-overasen is it might be possible, that you can checkout the branch locally for testing in your project?

I added several Integration Tests to run with Composer v2 and also tested a lot locally on my machine. So far it works good for me, but considering, that at Inpsyde, some of our Tools are not supporting Composer v2 yet (like https://github.com/franzliedke/studio), it's hard for me to upgrade and test it in actualy projects as well. As company, we probably will still stick a while with Composer v1.

stian-overasen commented 3 years ago

I'll get right on that @Chrico ! Thank you for the quick response!

stian-overasen commented 3 years ago

Works great @Chrico, both with Composer 1 and Composer 2. :thumbsup:

Chrico commented 3 years ago

Cheers @stian-overasen !

Thanks for the feedback. After some more time spending on testing different scenarios and projects, i finally created a new 2.0 release of WP Translation Downloader. :-) If it's okay for you, i'll close that issue after weekend. 👍