From 7f201ca38e8338df3e5da242309c271035d6f9c1 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Mon, 19 Feb 2024 16:37:05 +0000 Subject: [PATCH] Avoid use of str_starts_with / str_ends_with --- src/Vendor/Composer/VersionConstraintNormalizer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Vendor/Composer/VersionConstraintNormalizer.php b/src/Vendor/Composer/VersionConstraintNormalizer.php index 35dfd58a..d834fa71 100644 --- a/src/Vendor/Composer/VersionConstraintNormalizer.php +++ b/src/Vendor/Composer/VersionConstraintNormalizer.php @@ -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;