Skip to content

Handling of shadow dependency related to suggested extensions #228

@cedric-anne

Description

@cedric-anne

I work on a application that propose optional features that are only used when the corresponding extension is installed.

The following piece of code generates a SHADOW_DEPENDENCY error:

if (\extension_loaded('posix') && \posix_geteuid() === 0) {
    // ...
}

I can mark this error as ignored using either ignoreErrorsOnExtensionAndPaths() or ignoreErrorsOnExtension(), but it does not permit to target explicitely a precise code line to ignore. If in the future a contributor adds another usage of a function of the same extension, but without the proper check, it would not be detected.

The ideal solution for this use case, IMHO, would be to have a // @composer-dependency-analyser-ignore shadow-dependency comment that could be added on the corresponding line code to ignore this specific line only.

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