shipmonk-rnd / composer-dependency-analyser

🚀 Fast detection of composer dependency issues (unused dependencies, shadow dependencies, misplaced dependencies)
MIT License
458 stars 10 forks source link

Suggested `ext-*` are reported as unused (or only used in dev) #206

Open VincentLanglet opened 4 days ago

VincentLanglet commented 4 days ago

Let's say I use this lib https://github.com/Intervention/image/blob/develop/composer.json#L34

The lib suggests to use ext-exif but does not hard-require it.

When adding ext-exif to my composer.json, it's reported as unused by the composer-dependency-analyser (awesome tool btw), but having or not this extension gives a different behavior when using such library. There is also a lot of others dependencies which have "required" extensions, in suggest.

Message like

for ext which are suggested might lead to removing the library with bad impact in production.

I assume the same might exists for lib suggested (?), because a dependency could have the implementation

if (class_exists(SuggestedDependency::class)) {
     // do this
} else {
    // do that, which is not as good
}

So maybe a different behavior should exist for suggested libraries/ext ? or an option to not report unused lib/ext if they are suggested ?

janedbal commented 3 days ago

Yeah, extensions are a bit more tricky due to that optional dependency in libraries (example). Adjusting reported issues for suggested extensions might improve the DX there for sure. I'll consider it.