Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/GenerateFlexEndpointCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ private function generatePackageJson(string $package, string $version, array $ma
{
unset($manifest['aliases']);

if (isset($manifest['add-lines']) && is_array($manifest['add-lines'])) {
foreach ($manifest['add-lines'] as $i => $config) {
if (isset($config['content']) && is_array($config['content'])) {
$manifest['add-lines'][$i]['content'] = implode("\n", $config['content']);
}
}
}

$files = [];
$it = new \RecursiveDirectoryIterator($package.'/'.$version);
$it->setFlags($it::SKIP_DOTS | $it::FOLLOW_SYMLINKS | $it::UNIX_PATHS);
Expand Down
19 changes: 18 additions & 1 deletion src/LintManifestsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,24 @@ private function isAddLinesValid(mixed $data, string $manifest, OutputInterface
continue;
}

if (!is_string($addLine[$key])) {
if ('content' === $key) {
if (!is_string($addLine[$key]) && !is_array($addLine[$key])) {
$output->writeln(sprintf('::error file=%s::"add-lines" (index %d) has a "%s" key but it must be a string or an array of strings', $manifest, $index, $key));
$isValid = false;

continue;
}

if (is_array($addLine[$key])) {
foreach ($addLine[$key] as $lineIndex => $line) {
if (!is_string($line)) {
$output->writeln(sprintf('::error file=%s::"add-lines" (index %d) has a "%s" array but element at index %d is not a string', $manifest, $index, $key, $lineIndex));

$isValid = false;
}
}
}
} elseif (!is_string($addLine[$key])) {
$output->writeln(sprintf('::error file=%s::"add-lines" (index %d) has a "%s" key but it must be a string value', $manifest, $index, $key));

$isValid = false;
Expand Down