Skip to content

Commit

Permalink
Use compacted constraint without stability flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Jul 29, 2024
1 parent ec76ce4 commit 884e365
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions indexer/src/Package/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,7 @@ private function buildContaoConstraint(array $versions): string|null
}

try {
$constraint = (new VersionParser())->parseConstraints($constraint)->getPrettyString();

foreach (explode('||', $constraint) as $c) {
$c = trim($c);

if (str_starts_with(ltrim($c, '<>=^~'), '3.')) {
continue;
}

$constraints[] = $c;
}
$constraints[] = (new VersionParser())->parseConstraints($constraint);
} catch (\Throwable) {
// Ignore
}
Expand All @@ -218,9 +208,11 @@ private function buildContaoConstraint(array $versions): string|null
return null;
}

$constraints = array_unique($constraints);
$constraint = (string) Intervals::compactConstraint(MultiConstraint::create($constraints, false));
$constraint = str_replace(['[', ']'], '', $constraint);
$constraint = preg_replace('{(\d+\.\d+\.\d+)\.\d+(-dev)?( |$)}', '$1 ', $constraint);

return implode(' || ', $constraints);
return trim($constraint);
}

private function buildContaoVersions(string $contaoConstraint): array
Expand Down

0 comments on commit 884e365

Please sign in to comment.