phpstan / extension-installer

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

Disabling the plugin does not flush out generated config in an existing dev environment #85

Closed mxr576 closed 4 months ago

mxr576 commented 5 months ago

We have noticed that disabling phpstan/extension-installer/ plugin in the right way :tm: and running composer i or composer update --lock or any other command does not regenerate and flush out the generated file at vendor/phpstan/extension-installer/src/GeneratedConfig.php.

mxr576 commented 5 months ago

I haven't tested it, but I assume the ignore feature comes with the same limitation atm.

https://github.com/phpstan/extension-installer?tab=readme-ov-file#ignoring-a-particular-extension

ondrejmirtes commented 5 months ago

What is your use case? Why disable the plugin this way when you can just uninstall it?

mxr576 commented 5 months ago

Drupal added phpstan/extension installer a default enabled plugin to its composer project. When we create new sandbox project from this composer project template the extension installer is already enabled. When we install our own package on the top of this installation - that has a feature like: "phpstan.neon.dist and phpstan.baseline.neon gets copied to the Composer project root if they do not exist" - then we are reaching the problem that this issue is about.

Why our package works like that? Because we wanted to have 100% control over which rules are active on our projects and this feature in our package (AFAIK) was available sooner than the plugin disable feature was added to Composer or the ignore feature were added to the extension installer.

Even this is not a major bug, since it only affects running local dev envs, I think fixing it would not be a huge effort, just the plugin should subscribe to more Composer events and regenerate config not only when an extension package is installed, updated or removed.

ondrejmirtes commented 5 months ago

just the plugin should subscribe to more Composer events and regenerate config not only when an extension package is installed, updated or removed

Which event would that be?

ondrejmirtes commented 4 months ago

I confirmed it by Composer creators that plugins cannot do anything about this when it happens.

mxr576 commented 4 months ago

Thanks @ondrejmirtes , sorry, my focus was shifted and I also realized that this might be a chicken and egg problem and the plugin has no way to react to this... or precisely I wanted to check if deactivate() is called or not, just did not find time for that yet.

github-actions[bot] commented 3 months 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.