|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * This file is part of the mimmi20/monolog-factory package. |
| 5 | + * |
| 6 | + * Copyright (c) 2022-2024, Thomas Mueller <[email protected]> |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +declare(strict_types = 1); |
| 13 | + |
| 14 | +use ShipMonk\ComposerDependencyAnalyser\Config\Configuration; |
| 15 | +use ShipMonk\ComposerDependencyAnalyser\Config\ErrorType; |
| 16 | + |
| 17 | +$config = new Configuration(); |
| 18 | + |
| 19 | +$config |
| 20 | + // Adjusting scanned paths |
| 21 | + ->addPathToScan(__DIR__ . '/src', isDev: false) |
| 22 | + ->addPathToScan(__DIR__ . '/tests', isDev: true) |
| 23 | + ->addPathToScan(__DIR__ . '/vendor', isDev: false) |
| 24 | + ->addPathToExclude(__DIR__ . '/vendor/rector/rector') |
| 25 | + ->addPathToExclude(__DIR__ . '/vendor/phpstan/phpstan') |
| 26 | + // applies only to directory scanning, not directly listed files |
| 27 | + ->setFileExtensions(['php']) |
| 28 | + |
| 29 | + // Ignoring errors in vendor directory |
| 30 | + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::SHADOW_DEPENDENCY]) |
| 31 | + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_FUNCTION]) |
| 32 | + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::UNKNOWN_CLASS]) |
| 33 | + ->ignoreErrorsOnPath(__DIR__ . '/src', [ErrorType::UNKNOWN_CLASS]) |
| 34 | + ->ignoreErrorsOnPath(__DIR__ . '/tests', [ErrorType::UNKNOWN_CLASS]) |
| 35 | + ->ignoreErrorsOnPath(__DIR__ . '/vendor', [ErrorType::DEV_DEPENDENCY_IN_PROD]) |
| 36 | + ->ignoreErrorsOnPath(__DIR__ . '/src', [ErrorType::DEV_DEPENDENCY_IN_PROD]) |
| 37 | + |
| 38 | + // do not complain about some modules |
| 39 | + ->ignoreErrorsOnPackage('mimmi20/coding-standard', [ErrorType::UNUSED_DEPENDENCY]) |
| 40 | + ->ignoreErrorsOnPackage('phpstan/extension-installer', [ErrorType::UNUSED_DEPENDENCY]) |
| 41 | + ->ignoreErrorsOnPackage('phpstan/phpstan-phpunit', [ErrorType::UNUSED_DEPENDENCY]) |
| 42 | + ->ignoreErrorsOnPackage('phpstan/phpstan-deprecation-rules', [ErrorType::UNUSED_DEPENDENCY]) |
| 43 | + |
| 44 | + // Adjust analysis |
| 45 | + // dev packages are often used only in CI, so this is not enabled by default |
| 46 | + ->enableAnalysisOfUnusedDevDependencies(); |
| 47 | + |
| 48 | +return $config; |
0 commit comments