From 829e0e767ffc4533904612668ea9479dba8f3997 Mon Sep 17 00:00:00 2001 From: Yanick Witschi Date: Wed, 8 May 2024 14:27:20 +0200 Subject: [PATCH] Re-use precalculated information (#11968) Co-authored-by: Jordi Boggiano --- src/Composer/DependencyResolver/DefaultPolicy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/DependencyResolver/DefaultPolicy.php b/src/Composer/DependencyResolver/DefaultPolicy.php index f8176ae72..c60853428 100644 --- a/src/Composer/DependencyResolver/DefaultPolicy.php +++ b/src/Composer/DependencyResolver/DefaultPolicy.php @@ -57,7 +57,7 @@ class DefaultPolicy implements PolicyInterface } // dev versions need to be compared as branches via matchSpecific's special treatment, the rest can be optimized with compiling matcher - if (strpos($a->getVersion(), 'dev-') === 0 || strpos($b->getVersion(), 'dev-') === 0) { + if (($a->isDev() && str_starts_with($a->getVersion(), 'dev-')) || ($b->isDev() && str_starts_with($b->getVersion(), 'dev-'))) { $constraint = new Constraint($operator, $b->getVersion()); $version = new Constraint('==', $a->getVersion());