composer-unused / composer-unused-plugin

Composer plugin for composer-unused
MIT License
15 stars 0 forks source link

Does it make sense to require regular package since plugin uses PHAR file? #27

Open Wirone opened 3 weeks ago

Wirone commented 3 weeks ago

There is requirement, which leads to problems during installation in projects that require nikic/php-parser v5:

composer require --dev composer-unused/composer-unused-plugin
./composer.json has been updated
Running composer update composer-unused/composer-unused-plugin
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - composer-unused/composer-unused-plugin 0.8.11 requires icanhazstring/composer-unused ^0.8.11 -> satisfiable by icanhazstring/composer-unused[0.8.11].
    - composer-unused/composer-unused-plugin[0.8.9, ..., 0.8.10] require icanhazstring/composer-unused ^0.8.8 -> satisfiable by icanhazstring/composer-unused[0.8.8, 0.8.9, 0.8.10, 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.8 requires icanhazstring/composer-unused ^0.8.7 -> satisfiable by icanhazstring/composer-unused[0.8.7, ..., 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.7 requires icanhazstring/composer-unused ^0.8.6 -> satisfiable by icanhazstring/composer-unused[0.8.6, ..., 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.6 requires icanhazstring/composer-unused ^0.8.5 -> satisfiable by icanhazstring/composer-unused[0.8.5, ..., 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.5 requires icanhazstring/composer-unused ^0.8.4 -> satisfiable by icanhazstring/composer-unused[0.8.4, ..., 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.4 requires icanhazstring/composer-unused ^0.8.3 -> satisfiable by icanhazstring/composer-unused[0.8.3, ..., 0.8.11].
    - composer-unused/composer-unused-plugin 0.8.3 requires icanhazstring/composer-unused ^0.8.2 -> satisfiable by icanhazstring/composer-unused[0.8.2, ..., 0.8.11].
    - composer-unused/composer-unused-plugin[0.8.0, ..., 0.8.1] require icanhazstring/composer-unused ^0.8 -> satisfiable by icanhazstring/composer-unused[0.8.0, ..., 0.8.11].
    - icanhazstring/composer-unused[0.8.0, ..., 0.8.2] require nikic/php-parser ^4.13 -> found nikic/php-parser[v4.13.0, ..., v4.19.1] but the package is fixed to v5.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - icanhazstring/composer-unused[0.8.3, ..., 0.8.11] require nikic/php-parser ^4.15 -> found nikic/php-parser[v4.15.0, ..., v4.19.1] but the package is fixed to v5.0.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - Root composer.json requires composer-unused/composer-unused-plugin * -> satisfiable by composer-unused/composer-unused-plugin[0.8.0, ..., 0.8.11].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require composer-unused/composer-unused-plugin:*" to figure out if any version is installable, or "composer require composer-unused/composer-unused-plugin:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Is it actually needed to install base package along the plugin, even though the plugin uses bundled PHAR, which has base package's dependencies built-in?

icanhazstring commented 3 weeks ago

Either or :)

If you install the plugin, the phar file will be shipped. But at the moment the "plugin" really needs more love.

The idea for the plugin was to have it in the same way as phpstan and phpstan-src. So with the plugin, you would install a composer plugin for composer unused command and download the phar to avoid conflicts with other tooling-related dependencies.

But this didn't work properly in the past, as the symfony/console library for phar builds and the ones you installed were outdated. But this is solved now. So typically, in an ideal world - you only need the plugin to be installed :)

Wirone commented 3 weeks ago

I get the idea behind the plugin (shim package + UX), I was just confused by the requirement of base package, since it looks superfluous in terms of running the tool (because bundled PHAR is used). The only reason I can think of is IDE support in config file, because symbols are provided by the base package.