phparch icon indicating copy to clipboard operation
phparch copied to clipboard

Classes of PHP extensions not detected via composer `ext-*`

Open marc-mabe opened this issue 2 years ago • 0 comments

I have the following in my composer.json

    "require": {
        "ext-ds": "*",
    }

but I still get an error if I'm using Ds\\* classes: App must only depend on dependencies in /app/tests/../composer.json (/app/tests/../composer.lock) but XXX depends on Ds\Map.

As workaround I had to add Ds\\ as explicitly allowed dependency:

        $composerParser = new ComposerFileParser(__DIR__ . '/../composer.json');
        $validator      = new MustOnlyDependOnComposerDependencies('App\\', $composerParser);

        // ext-ds is not listed as dev dependency
        $validator = new ExplicitlyAllowDependency($validator, 'App\\', 'Ds\\');

        $this->phpArch->validate($validator);

marc-mabe avatar Sep 12 '22 13:09 marc-mabe