You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.0 KiB
PHP

<?php
declare(strict_types=1);
use Deptrac\Deptrac\Contract\Config\Collector\BoolConfig;
use Deptrac\Deptrac\Contract\Config\Collector\ClassLikeConfig;
use Deptrac\Deptrac\Contract\Config\Collector\LayerConfig;
use Deptrac\Deptrac\Contract\Config\DeptracConfig;
use Deptrac\Deptrac\Contract\Config\Layer;
use Deptrac\Deptrac\Contract\Config\Ruleset;
return static function (DeptracConfig $config): void {
$config
->paths('./src')
->excludeFiles('#.*test.*#')
->layers(
$analyzePublic = Layer::withName('AnalyzePublic')
->collectors(
ClassLikeConfig::create('Kartierung\\Analyze\\Exception\\.+'),
ClassLikeConfig::create('Kartierung\\Analyze\\Result\\.+'),
ClassLikeConfig::create('Kartierung\\Analyze\\RepositoryAnalyzer'),
ClassLikeConfig::create('Kartierung\\Analyze\\EntityAnalyzer'),
ClassLikeConfig::create('Kartierung\\Analyze\\RecursionCheck')
),
$analyze = Layer::withName('Analyze')
->collectors(
BoolConfig::create(
must: [ClassLikeConfig::create('Kartierung\\Analyze\\.+')],
mustNot: [
LayerConfig::create($analyzePublic)
]
)
),
$attribute = Layer::withName('Attribute')
->collectors(
ClassLikeConfig::create('Kartierung\\Attribute\\.+'),
),
$repository = Layer::withName('Repository')
->collectors(
ClassLikeConfig::create('Kartierung\\Repository\\.+')
)
)
->rulesets(
Ruleset::forLayer($analyze)
->accesses($attribute),
Ruleset::forLayer($analyzePublic)
->accesses($attribute)
->accesses($analyze),
Ruleset::forLayer($repository)
->accesses($analyzePublic)
);
};