Skip to content

Commit 4b9810f

Browse files
committed
Fix
1 parent d535247 commit 4b9810f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/FileSystem/ComposerJsonPackageVersionUpdater.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,24 @@ final class ComposerJsonPackageVersionUpdater
1111
public static function update(string $composerJsonContents, string $packageName, string $newVersion): string
1212
{
1313
// replace using regex, to keep original composer.json format
14-
return Strings::replace(
14+
$allChanges = Strings::replace(
1515
$composerJsonContents,
1616
// find
1717
sprintf('#"%s": "(.*?)"#', $packageName),
1818
// replace
1919
sprintf('"%s": "%s"', $packageName, $newVersion)
2020
);
21+
22+
$suggestContent = Strings::match($composerJsonContents, '#"suggest"\s*:\s*{[^}]*}#');
23+
24+
if ($suggestContent !== null) {
25+
$allChanges = Strings::replace(
26+
$allChanges,
27+
'#"suggest"\s*:\s*{[^}]*}#',
28+
$suggestContent[0]
29+
);
30+
}
31+
32+
return $allChanges;
2133
}
2234
}

0 commit comments

Comments
 (0)