Skip to content

Commit

Permalink
Merge pull request #25 from Aeliot-Tm/fix_parrtern_linter
Browse files Browse the repository at this point in the history
Fix YAML Key Pattern Linter
  • Loading branch information
Aeliot-Tm authored May 12, 2021
2 parents ee74660 + 4424493 commit ca3c239
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Service/Yaml/Linter/KeyPatternLinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ final class KeyPatternLinter implements LinterInterface
{
private FilesMapProvider $filesMapProvider;
private KeysParser $keysParser;
private string $keyPattern;
private ?string $keyPattern;

public function __construct(FilesMapProvider $filesMapProvider, KeysParser $keysParser, string $yamlKeyPattern)
public function __construct(FilesMapProvider $filesMapProvider, KeysParser $keysParser, ?string $yamlKeyPattern)
{
$this->filesMapProvider = $filesMapProvider;
$this->keysParser = $keysParser;
Expand All @@ -35,6 +35,10 @@ public function getPresets(): array

public function lint(LintYamlFilterDto $filterDto): ReportBag
{
if (!$this->keyPattern) {
throw new \LogicException('YAML Key Pattern Linter is not configured yet');
}

$bag = new ReportBag(KeysPatternLine::class);
$domainsFiles = $this->filesMapProvider->getFilesMap();
foreach ($domainsFiles as $domain => $localesFiles) {
Expand Down

0 comments on commit ca3c239

Please sign in to comment.