shipmonk-rnd / composer-dependency-analyser

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

False positives with DB-specific PDO extensions #195

Open jlherren opened 3 hours ago

jlherren commented 3 hours ago

First, I love the new extension detection in 1.8.0! ❤️ I discovered extensions in composer.json that I wasn't using.

However, it now flags ext-pdo_sqlite and ext-pdo_mysql as being unused, when they are clearly used in code such as:

$pdo = new PDO('sqlite::memory:')

I understand that this will be hard to detect precisely, so maybe error reporting on ext-pdo_* should be excluded entirely? Errors on ext-pdo work fine.

janedbal commented 3 hours ago

Currently, the analysis relies solely on used symbols in your codebase. PDO class belongs to ext-pdo. Looks like no ext-pdo_xxx has any dedicated symbols, so those will probably always be reported as unused.

I'll consider marking those as used when ext-pdo is used.

janedbal commented 2 hours ago

Looks like no ext-pdo_xxx has any dedicated symbols

Hm, that is no longer true since PHP 8.4: