diff --git a/composer.json b/composer.json index a62f017..f05bff4 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "require": { "php": "~8.1|~8.2|~8.3", "phpstan/phpstan": "^1.11", - "shipmonk/composer-dependency-analyser": "1.6.1" + "shipmonk/composer-dependency-analyser": "1.7.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 14814e0..a53e51c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0b278c660ab31f01c4b1ee5154ee39a5", + "content-hash": "a6980c3f108bdaeedaf9a0fd04e825b1", "packages": [ { "name": "phpstan/phpstan", @@ -66,16 +66,16 @@ }, { "name": "shipmonk/composer-dependency-analyser", - "version": "1.6.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/shipmonk-rnd/composer-dependency-analyser.git", - "reference": "9252ee58b802328237ebbd4e1decb002823afbb2" + "reference": "bca862b2830a453734aee048eb0cdab82e5c9da3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/shipmonk-rnd/composer-dependency-analyser/zipball/9252ee58b802328237ebbd4e1decb002823afbb2", - "reference": "9252ee58b802328237ebbd4e1decb002823afbb2", + "url": "https://api.github.com/repos/shipmonk-rnd/composer-dependency-analyser/zipball/bca862b2830a453734aee048eb0cdab82e5c9da3", + "reference": "bca862b2830a453734aee048eb0cdab82e5c9da3", "shasum": "" }, "require": { @@ -126,9 +126,9 @@ ], "support": { "issues": "https://github.com/shipmonk-rnd/composer-dependency-analyser/issues", - "source": "https://github.com/shipmonk-rnd/composer-dependency-analyser/tree/1.6.1" + "source": "https://github.com/shipmonk-rnd/composer-dependency-analyser/tree/1.7.0" }, - "time": "2024-07-02T20:09:30+00:00" + "time": "2024-08-08T08:12:32+00:00" } ], "packages-dev": [ diff --git a/phpstan.neon b/phpstan.neon index fdc767f..a2797da 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,19 @@ +includes: + - extension.neon + parameters: level: 8 - checkGenericClassInNonGenericObjectType: false paths: - - src \ No newline at end of file + - src + + ignoreErrors: + - + identifier: missingType.generics + + composerAnalysis: + ignoreAllShadowDeps: false + ignoreAllDevDepsInProd: false + ignoreAllProdDepsInDev: false + ignoreAllUnusedDeps: false + ignoreSpecificUnusedDeps: + - phpstan/phpstan \ No newline at end of file diff --git a/src/ComposerCollector.php b/src/ComposerCollector.php index e3c228e..d753e7c 100644 --- a/src/ComposerCollector.php +++ b/src/ComposerCollector.php @@ -63,23 +63,23 @@ public function __construct(string $cwd, array $options) private function runComposerDependencyAnalyser(): AnalysisResult { // From vendor/shipmonk/composer-dependency-analyser/bin/composer-dependency-analyser - $stdOutPrinter = new Printer(STDOUT); - $stdErrPrinter = new Printer(STDERR); - $initializer = new ComposerInitializer($this->cwd, $stdOutPrinter, $stdErrPrinter); + $stdOutPrinter = new Printer(resource: STDOUT); + $stdErrPrinter = new Printer(resource: STDERR); + $initializer = new ComposerInitializer(cwd: $this->cwd, stdOutPrinter: $stdOutPrinter, stdErrPrinter: $stdErrPrinter); $stopwatch = new Stopwatch; - $options = $initializer->initCliOptions($this->cwd, []); - $composerJson = $initializer->initComposerJson($options); - $initializer->initComposerAutoloader($composerJson); - $configuration = $initializer->initConfiguration($options, $composerJson); + $options = $initializer->initCliOptions(cwd: $this->cwd, argv: []); + $composerJson = $initializer->initComposerJson(options: $options); + $initializer->initComposerAutoloader(composerJson: $composerJson); + $configuration = $initializer->initConfiguration(options: $options, composerJson: $composerJson); $configuration->ignoreErrors([ErrorType::UNKNOWN_CLASS, ErrorType::UNKNOWN_FUNCTION]); foreach ($this->additionalProdPaths as $path) { - $configuration->addPathToScan($path, false); + $configuration->addPathToScan(path: $path, isDev: false); } foreach ($this->additionalDevPaths as $path) { - $configuration->addPathToScan($path, true); + $configuration->addPathToScan(path: $path, isDev: true); } if ($this->ignoreAllShadowDeps) { @@ -104,7 +104,13 @@ private function runComposerDependencyAnalyser(): AnalysisResult $classLoaders = $initializer->initComposerClassLoaders(); - return (new Analyser($stopwatch, $classLoaders, $configuration, $composerJson->dependencies))->run(); + return (new Analyser( + stopwatch: $stopwatch, + defaultVendorDir: $composerJson->composerVendorDir, + classLoaders: $classLoaders, + config: $configuration, + composerJsonDependencies: $composerJson->dependencies + ))->run(); } /**