Skip to content

Commit 12edd87

Browse files
janedbalondrejmirtes
authored andcommitted
composer-dependency-analyser: detect also unused dependencies
1 parent 5bd64f4 commit 12edd87

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

build/composer-dependency-analyser.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,33 @@
55

66
$config = new Configuration();
77

8+
$polyfills = [
9+
'symfony/polyfill-intl-grapheme',
10+
'symfony/polyfill-intl-normalizer',
11+
'symfony/polyfill-mbstring',
12+
'symfony/polyfill-php73',
13+
'symfony/polyfill-php74',
14+
'symfony/polyfill-php80',
15+
'symfony/polyfill-php81',
16+
];
17+
18+
$pinnedToSupportPhp72 = [
19+
'symfony/process',
20+
'symfony/service-contracts',
21+
'symfony/string',
22+
];
23+
824
return $config
925
->addPathToScan(__DIR__ . '/../bin', true)
10-
->ignoreErrors([ErrorType::UNUSED_DEPENDENCY])
26+
->ignoreErrorsOnPackages(
27+
[
28+
'hoa/regex', // used only via stream wrapper hoa://
29+
'react/async', // function usage (https://github.com/shipmonk-rnd/composer-dependency-analyser/issues/67)
30+
...$pinnedToSupportPhp72, // those are unused, but we need to pin them to support PHP 7.2
31+
...$polyfills, // not detected by composer-dependency-analyser
32+
],
33+
[ErrorType::UNUSED_DEPENDENCY],
34+
)
1135
->ignoreErrorsOnPackage('phpunit/phpunit', [ErrorType::DEV_DEPENDENCY_IN_PROD]) // prepared test tooling
1236
->ignoreErrorsOnPackage('jetbrains/phpstorm-stubs', [ErrorType::PROD_DEPENDENCY_ONLY_IN_DEV]) // there is no direct usage, but we need newer version then required by ondrejmirtes/BetterReflection
1337
->ignoreErrorsOnPath(__DIR__ . '/../tests', [ErrorType::UNKNOWN_CLASS]) // to be able to test invalid symbols

0 commit comments

Comments
 (0)