Skip to content

Commit

Permalink
only set private if true
Browse files Browse the repository at this point in the history
  • Loading branch information
Gennadi McKelvey committed Nov 19, 2022
1 parent 99d149a commit a33c585
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
3 changes: 2 additions & 1 deletion deptrac.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
),
$outputFormatter = Layer::withName('OutputFormatter')->collectors(
DirectoryConfig::public('src/Supportive/OutputFormatter/.*'),
ClassNameConfig::private(regex('^phpDocumentor\\\\GraphViz\\\\.*')),
ClassNameConfig::private(regex('^phpDocumentor\\GraphViz\\.*')),
),
$file = Layer::withName('File')->collectors(
DirectoryConfig::public('src/Supportive/File/.*')
Expand All @@ -86,6 +86,7 @@
)
->formatters(
GraphvizConfig::create()
->pointsToGroup(true)
->groups('Contract', $contract)
->groups('Supportive', $supportive, $file)
->groups('Symfony', $console, $dependencyInjection, $outputFormatter)
Expand Down
2 changes: 1 addition & 1 deletion src/Contract/Config/Collector/BoolConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public function withMust(CollectorConfig $CollectorConfig): self
public function toArray(): array
{
return parent::toArray() + [
'must' => array_map(static fn (CollectorConfig $v) => $v->toArray(), $this->must),
'must_not' => array_map(static fn (CollectorConfig $v) => $v->toArray(), $this->mustNot),
'must' => array_map(static fn (CollectorConfig $v) => $v->toArray(), $this->must),
];
}
}
11 changes: 7 additions & 4 deletions src/Contract/Config/CollectorConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ protected function __construct(
*/
public function toArray(): array
{
return [
'type' => $this->collectorType->value,
'private' => $this->private,
];
if ($this->private) {
$output['private'] = $this->private;
}

$output['type'] = $this->collectorType->value;

return $output;
}
}
16 changes: 8 additions & 8 deletions src/Contract/Config/DeptracConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ public function toArray(): array
$config['paths'] = $this->paths;
}

if ([] !== $this->analyser) {
$config['analyser']['types'] = array_map(static fn (EmitterType $emitterType) => $emitterType->value, $this->analyser);
}

if ([] !== $this->formatters) {
$config['formatters'] = array_map(static fn (FormatterConfigInterface $formatterConfig) => $formatterConfig->toArray(), $this->formatters);
}

if ([] !== $this->excludeFiles) {
$config['exclude_files'] = $this->excludeFiles;
}
Expand All @@ -114,14 +122,6 @@ public function toArray(): array
$config['skip_violations'] = $this->skipViolations;
}

if ([] !== $this->formatters) {
$config['formatters'] = array_map(static fn (FormatterConfigInterface $formatterConfig) => $formatterConfig->toArray(), $this->formatters);
}

if ([] !== $this->skipViolations) {
$config['analyser']['types'] = array_map(static fn (EmitterType $emitterType) => $emitterType->value, $this->analyser);
}

$config['ignore_uncovered_internal_classes'] = $this->ignoreUncoveredInternalClasses;
$config['use_relative_path_from_depfile'] = $this->useRelativePathFromDepfile;

Expand Down

0 comments on commit a33c585

Please sign in to comment.