From bbab31b564aec29d0a45480302e222c7c9a5ff7d Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 9 Dec 2024 14:25:32 +0100 Subject: [PATCH] Fix bump-after-update when passing inline constraints, fixes #12223 --- src/Composer/Command/BumpCommand.php | 4 ++++ tests/Composer/Test/Command/BumpCommandTest.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/BumpCommand.php b/src/Composer/Command/BumpCommand.php index a87a65e1c..4570ce2a3 100644 --- a/src/Composer/Command/BumpCommand.php +++ b/src/Composer/Command/BumpCommand.php @@ -153,6 +153,10 @@ EOT } if (count($packagesFilter) > 0) { + // support proxied args from the update command that contain constraints together with the package names + $packagesFilter = array_map(function ($constraint) { + return Preg::replace('{[:= ].+}', '', $constraint); + }, $packagesFilter); $pattern = BasePackage::packageNamesToRegexp(array_unique(array_map('strtolower', $packagesFilter))); foreach ($tasks as $key => $reqs) { foreach ($reqs as $pkgName => $link) { diff --git a/tests/Composer/Test/Command/BumpCommandTest.php b/tests/Composer/Test/Command/BumpCommandTest.php index 8e8161dcf..e83fb86fd 100644 --- a/tests/Composer/Test/Command/BumpCommandTest.php +++ b/tests/Composer/Test/Command/BumpCommandTest.php @@ -149,7 +149,7 @@ class BumpCommandTest extends TestCase 'dev/pkg' => '~2.0', ], ], - ['packages' => ['first/pkg', 'dev/*']], + ['packages' => ['first/pkg:3.0.1', 'dev/*']], [ 'require' => [ 'first/pkg' => '^2.3.4',