Skip to content

bug: packages of type metapackages always trigger unused dependency error #209

@doppynl

Description

@doppynl

Description

When you require a package of the type "metapackage", a scan always gives the error:

Found 1 unused dependency!
(those are listed in composer.json, but no usage was found in scanned paths)

Metapackages don't come with any files and will not appear to be used by code in most cases.

It can be used to include other dependencies or make sure some packages or versions of packages are not installed. I mainly use it to trigger conflicts with packages that have a bug in specific versions.
https://getcomposer.org/doc/04-schema.md#type

Bug

A package with type "metapackage" should not trigger an unused dependency error.

Usage of code that is installed because it is required by a metapackage should obviously still trigger a shadow-dependency error.

Workaround

You can add configuration to not trigger the error like so:

$config->ignoreErrorsOnPackage('vendor/package-name' [ErrorType::UNUSED_DEPENDENCY])

But it doesn't really make sense to always have to do this for a metapackage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions