phpstan / extension-installer

Composer plugin for automatic installation of PHPStan extensions.
MIT License
410 stars 27 forks source link

InvalidArgumentException on post-install-cmd: `PHPStan\ExtensionInstaller\Plugin->process` #55

Closed staabm closed 2 years ago

staabm commented 2 years ago

I am having a closed source phpstan plugin, declared as "type": "phpstan-extension", (composer.json) and it declares a

  "extra": {
    "phpstan": {
      "includes": [
        "packages/phpstan-rules/config/best-practices.neon"
      ]
    }
  },

the plugin itself is scanned via phpstan and phpstan is configured to use the plugins itself to scan itself.

while running composer install I am running into a InvalidArgumentException:

> post-install-cmd: PHPStan\ExtensionInstaller\Plugin->process

  [InvalidArgumentException]
  $from (C:\dvl\Workspace\php-clx-symplify\vendor\phpstan\extension-installer\src) and $to (vendor/plugins/rocket) mu
  st be absolute paths.

Exception trace:
 () at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Util/Filesystem.php:453
 Composer\Util\Filesystem->findShortestPath() at C:\dvl\Workspace\php-clx-symplify\vendor\phpstan\extension-installer\src\Plugin.php:120
 PHPStan\ExtensionInstaller\Plugin->process() at n/a:n/a
 call_user_func() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:192
 Composer\EventDispatcher\EventDispatcher->doDispatch() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/EventDispatcher/EventDispatcher.php:119
 Composer\EventDispatcher\EventDispatcher->dispatchScript() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Installer.php:372
 Composer\Installer->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Command/InstallCommand.php:139
 Composer\Command\InstallCommand->execute() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Command/Command.php:245
 Symfony\Component\Console\Command\Command->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:835
 Symfony\Component\Console\Application->doRunCommand() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:185
 Symfony\Component\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:336
 Composer\Console\Application->doRun() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Application.php:117
 Symfony\Component\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/Console/Application.php:131
 Composer\Console\Application->run() at phar://C:/ProgramData/ComposerSetup/bin/composer.phar/bin/composer:83
 require() at C:\ProgramData\ComposerSetup\bin\composer.phar:29

when running composer install -vvv

ondrejmirtes commented 2 years ago

No idea what's going on. Please create a small reproducing repository, ideally showing the error in GitHub Actions.

staabm commented 2 years ago

I think I found the underlying problem and asked within a composer discussion, how a proper fix should look like: https://github.com/composer/composer/discussions/10523

I was not yet able to build a reproducing repo though. I tried but it did not work yet.

staabm commented 2 years ago

should the extension installer check whether the path returned from a custom installer is absolute - and error if not?

ondrejmirtes commented 2 years ago

It's not necessary - it already errors.

github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.