Closed boesing closed 3 years ago
This feature might probably prevented https://github.com/mezzio/mezzio-cors/issues/8
This is actually hugely problematic, and it's something we chose not to do after getting user complaints.
The problem is if we do it at update, then if the user chose not to install it during initial install (e.g., they want to autoload, but do not want services registered), it is now prompting them to inject it again during an update. And if they are not expecting that, and another package prompts prior to that and they answer "yes" when asked if they want to do the same for any other packages... they're now having it injected when they don't want to.
The only way we'd be able to manage this is to write to a file somewhere about the installation choices previously made, and that then means users have to commit that file in their repo, which leads to other problems as well.
What if we use composer.json to store that info?
What if we use composer.json to store that info?
yeah, was thinking about that when working on the dependency-plugin aswell. Storing "no" in composer.json might solve that problem.
But one could compare previous and new composer.json during update aswell and just ask if the previous Version did not had that "config-Provider" extra config. There is a build-in logic for that in the "UpdateOperation" object.
I've create a PoC in boesing/laminas-component-installer#2 It needs #25 to be merged before I can create a PR in here.
Reviews welcome.
Added #28 as #25 got merged today. 🎉
@weierophinney
The problem is if we do it at update, then if the user chose not to install it during initial install (e.g., they want to autoload, but do not want services registered), it is now prompting them to inject it again during an update. And if they are not expecting that, and another package prompts prior to that and they answer "yes" when asked if they want to do the same for any other packages... they're now having it injected when they don't want to.
The current implementation in #28 would prevent prompting over and over again. It would only prompt when removing vendor and re-installing (but thats the case right now aswell).
~I'll create a bug issue for that as thats something which annoys me aswell.~
~Due to laminas-validator
and its suggest
for laminas-db
, I have to require laminas-db
even tho we are not using it, so that psalm does not die with an error.~
~As we do not need laminas-db
at all, we do not add it to the modules.php
but everytime I am cleaning my vendors directory to re-install deps, laminas-component-installer
remembers me that we have to require laminas-db
as dev-dependency
for psalm.~
Looks like this got fixed in v4.7 of psalm. 🤷🏼♂️
Feature Request
Summary
When upgrading a package which did not provide a
ConfigProvider
/Module
in the initial version, the plugin does not add missingConfigProvider
/Module
.Thats actually the case for laminas-diactoros v2.2 to laminas-diactoros v2.3 which introduced the
ConfigProvider
to register PSR-17 interfaces.I'd love to see
ConfigProvider
/Module
is being injected when updating a package aswell as installing/uninstalling it.