Closed LastDragon-ru closed 3 months ago
I think the proper way is to process paths from shortest to longest. That way any more specific mark overrides the more genetic one no matter how those were added to the list.
Fixed in https://github.com/shipmonk-rnd/composer-dependency-analyser/pull/142.
For older versions, you can disable automatic autoload and adjust the order of paths manually:
$config->disableComposerAutoloadPathScan()
->addPathToScan('path/to', false)
->addPathToScan('path/to/dev-file.php', true)
Cool, I'll try it tomorrow. Thanks :)
I faced a problem about File/Dir
dev
flag priority. Let's imagine that we havecomposer.json
and we want to add
path/to/dev-file.php
as a dev dependency incomposer-dependency-analyser.php
:Unfortunately, it will not work :( because the
dev
flag will be overwriten byautoload
inhttps://github.com/shipmonk-rnd/composer-dependency-analyser/blob/2a45e4e7f58f45bf8f63032fc2da04652aec48ff/src/Analyser.php#L278-L293
I see a few options:
1) Provide access to
ComposerJson
incomposer-dependency-analyser.php
that will allow redefine order of scanned paths.2) Do not override file
dev
flag by directory flag.What do you think? Maybe I've missed something and there is another way? (except reimplementing
ComposerJson
...).