Skip to content

Commit

Permalink
Avoid use of str_starts_with / str_ends_with
Browse files Browse the repository at this point in the history
  • Loading branch information
fredden committed Feb 19, 2024
1 parent 9846ba7 commit 7f201ca
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Vendor/Composer/VersionConstraintNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,13 @@ private static function assertDevPrefixSuffixPosition(string $versionConstraint)
);

foreach ($split as &$part) {
if (\str_starts_with($part, 'dev-')) {
if (\strlen($part) <= 4) {
continue;
}

if (\strpos($part, 'dev-') === 0) {
$branch = \substr($part, 4);
} elseif (\str_ends_with($part, '-dev')) {
} elseif (\substr($part, -4) === '-dev') {
$branch = \substr($part, 0, -4);
} else {
continue;
Expand Down

0 comments on commit 7f201ca

Please sign in to comment.