diff --git a/src/LintManifestsCommand.php b/src/LintManifestsCommand.php index 89bfaed..15bf335 100644 --- a/src/LintManifestsCommand.php +++ b/src/LintManifestsCommand.php @@ -140,6 +140,8 @@ private function isAddLinesValid(mixed $data, string $manifest, OutputInterface } $isValid = true; + $targetPerContent = []; + foreach ($data as $index => $addLine) { foreach (['file', 'content', 'position'] as $key) { if (!isset($addLine[$key])) { @@ -175,6 +177,18 @@ private function isAddLinesValid(mixed $data, string $manifest, OutputInterface $isValid = false; } } + + $targetPerContent[$addLine['file']][$addLine['content']][] = $addLine['target']; + } + } + + foreach ($targetPerContent as $file => $filedTargets) { + foreach ($filedTargets as $targets) { + if (count($targets) > 1) { + $output->writeln(sprintf('::error file=%s::"add-lines" has the same content for the same file "%s" multiple times for different targets "%s". Only the first one would be applied', $manifest, $file, implode('", "', $targets))); + + $isValid = false; + } } }