1
0
Fork 0

Merge branch '2.6'

pull/11788/head
Jordi Boggiano 2024-01-08 16:10:20 +01:00
commit 284821543a
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
7 changed files with 72 additions and 57 deletions

98
composer.lock generated
View File

@ -8,16 +8,16 @@
"packages": [
{
"name": "composer/ca-bundle",
"version": "1.3.7",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
"reference": "76e46335014860eec1aa5a724799a00a2e47cc85"
"reference": "b66d11b7479109ab547f9405b97205640b17d385"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/76e46335014860eec1aa5a724799a00a2e47cc85",
"reference": "76e46335014860eec1aa5a724799a00a2e47cc85",
"url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385",
"reference": "b66d11b7479109ab547f9405b97205640b17d385",
"shasum": ""
},
"require": {
@ -29,7 +29,7 @@
"phpstan/phpstan": "^0.12.55",
"psr/log": "^1.0",
"symfony/phpunit-bridge": "^4.2 || ^5",
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0"
"symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"type": "library",
"extra": {
@ -64,7 +64,7 @@
"support": {
"irc": "irc://irc.freenode.org/composer",
"issues": "https://github.com/composer/ca-bundle/issues",
"source": "https://github.com/composer/ca-bundle/tree/1.3.7"
"source": "https://github.com/composer/ca-bundle/tree/1.4.0"
},
"funding": [
{
@ -80,7 +80,7 @@
"type": "tidelift"
}
],
"time": "2023-08-30T09:31:38+00:00"
"time": "2023-12-18T12:05:55+00:00"
},
{
"name": "composer/class-map-generator",
@ -765,16 +765,16 @@
},
{
"name": "seld/jsonlint",
"version": "1.10.0",
"version": "1.10.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/jsonlint.git",
"reference": "594fd6462aad8ecee0b45ca5045acea4776667f1"
"reference": "76d449a358ece77d6f1d6331c68453e657172202"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/594fd6462aad8ecee0b45ca5045acea4776667f1",
"reference": "594fd6462aad8ecee0b45ca5045acea4776667f1",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/76d449a358ece77d6f1d6331c68453e657172202",
"reference": "76d449a358ece77d6f1d6331c68453e657172202",
"shasum": ""
},
"require": {
@ -801,7 +801,7 @@
{
"name": "Jordi Boggiano",
"email": "j.boggiano@seld.be",
"homepage": "http://seld.be"
"homepage": "https://seld.be"
}
],
"description": "JSON Linter",
@ -813,7 +813,7 @@
],
"support": {
"issues": "https://github.com/Seldaek/jsonlint/issues",
"source": "https://github.com/Seldaek/jsonlint/tree/1.10.0"
"source": "https://github.com/Seldaek/jsonlint/tree/1.10.1"
},
"funding": [
{
@ -825,7 +825,7 @@
"type": "tidelift"
}
],
"time": "2023-05-11T13:16:46+00:00"
"time": "2023-12-18T13:03:25+00:00"
},
{
"name": "seld/phar-utils",
@ -938,16 +938,16 @@
},
{
"name": "symfony/console",
"version": "v5.4.32",
"version": "v5.4.34",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "c70df1ffaf23a8d340bded3cfab1b86752ad6ed7"
"reference": "4b4d8cd118484aa604ec519062113dd87abde18c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/c70df1ffaf23a8d340bded3cfab1b86752ad6ed7",
"reference": "c70df1ffaf23a8d340bded3cfab1b86752ad6ed7",
"url": "https://api.github.com/repos/symfony/console/zipball/4b4d8cd118484aa604ec519062113dd87abde18c",
"reference": "4b4d8cd118484aa604ec519062113dd87abde18c",
"shasum": ""
},
"require": {
@ -1017,7 +1017,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v5.4.32"
"source": "https://github.com/symfony/console/tree/v5.4.34"
},
"funding": [
{
@ -1033,7 +1033,7 @@
"type": "tidelift"
}
],
"time": "2023-11-18T18:23:04+00:00"
"time": "2023-12-08T13:33:03+00:00"
},
{
"name": "symfony/deprecation-contracts",
@ -1802,16 +1802,16 @@
},
{
"name": "symfony/process",
"version": "v5.4.28",
"version": "v5.4.34",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b"
"reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b",
"reference": "45261e1fccad1b5447a8d7a8e67aa7b4a9798b7b",
"url": "https://api.github.com/repos/symfony/process/zipball/8fa22178dfc368911dbd513b431cd9b06f9afe7a",
"reference": "8fa22178dfc368911dbd513b431cd9b06f9afe7a",
"shasum": ""
},
"require": {
@ -1844,7 +1844,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v5.4.28"
"source": "https://github.com/symfony/process/tree/v5.4.34"
},
"funding": [
{
@ -1860,7 +1860,7 @@
"type": "tidelift"
}
],
"time": "2023-08-07T10:36:04+00:00"
"time": "2023-12-02T08:41:43+00:00"
},
{
"name": "symfony/service-contracts",
@ -1947,16 +1947,16 @@
},
{
"name": "symfony/string",
"version": "v5.4.32",
"version": "v5.4.34",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "91bf4453d65d8231688a04376c3a40efe0770f04"
"reference": "e3f98bfc7885c957488f443df82d97814a3ce061"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/91bf4453d65d8231688a04376c3a40efe0770f04",
"reference": "91bf4453d65d8231688a04376c3a40efe0770f04",
"url": "https://api.github.com/repos/symfony/string/zipball/e3f98bfc7885c957488f443df82d97814a3ce061",
"reference": "e3f98bfc7885c957488f443df82d97814a3ce061",
"shasum": ""
},
"require": {
@ -2013,7 +2013,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v5.4.32"
"source": "https://github.com/symfony/string/tree/v5.4.34"
},
"funding": [
{
@ -2029,22 +2029,22 @@
"type": "tidelift"
}
],
"time": "2023-11-26T13:43:46+00:00"
"time": "2023-12-09T13:20:28+00:00"
}
],
"packages-dev": [
{
"name": "phpstan/phpstan",
"version": "1.10.50",
"version": "1.10.55",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4"
"reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4",
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9a88f9d18ddf4cf54c922fbeac16c4cb164c5949",
"reference": "9a88f9d18ddf4cf54c922fbeac16c4cb164c5949",
"shasum": ""
},
"require": {
@ -2093,7 +2093,7 @@
"type": "tidelift"
}
],
"time": "2023-12-13T10:59:42+00:00"
"time": "2024-01-08T12:32:40+00:00"
},
{
"name": "phpstan/phpstan-deprecation-rules",
@ -2246,16 +2246,16 @@
},
{
"name": "phpstan/phpstan-symfony",
"version": "1.3.5",
"version": "1.3.6",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan-symfony.git",
"reference": "27ff6339f83796a7e0dd963cf445cd3c456fc620"
"reference": "34b3c43684834f6a20aa51af8d455480d9de8b88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/27ff6339f83796a7e0dd963cf445cd3c456fc620",
"reference": "27ff6339f83796a7e0dd963cf445cd3c456fc620",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/34b3c43684834f6a20aa51af8d455480d9de8b88",
"reference": "34b3c43684834f6a20aa51af8d455480d9de8b88",
"shasum": ""
},
"require": {
@ -2312,22 +2312,22 @@
"description": "Symfony Framework extensions and rules for PHPStan",
"support": {
"issues": "https://github.com/phpstan/phpstan-symfony/issues",
"source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.5"
"source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.6"
},
"time": "2023-10-30T14:52:15+00:00"
"time": "2023-12-22T11:22:34+00:00"
},
{
"name": "symfony/phpunit-bridge",
"version": "v7.0.1",
"version": "v7.0.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "c2d059b25e31274157dd7727131cd1cf33650207"
"reference": "92df075808c9437beca9540e25ae0c40eea1c061"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/c2d059b25e31274157dd7727131cd1cf33650207",
"reference": "c2d059b25e31274157dd7727131cd1cf33650207",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/92df075808c9437beca9540e25ae0c40eea1c061",
"reference": "92df075808c9437beca9540e25ae0c40eea1c061",
"shasum": ""
},
"require": {
@ -2379,7 +2379,7 @@
"description": "Provides utilities for PHPUnit, especially user deprecation notices management",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v7.0.1"
"source": "https://github.com/symfony/phpunit-bridge/tree/v7.0.2"
},
"funding": [
{
@ -2395,7 +2395,7 @@
"type": "tidelift"
}
],
"time": "2023-12-01T09:26:31+00:00"
"time": "2023-12-19T11:23:03+00:00"
}
],
"aliases": [],

View File

@ -268,10 +268,18 @@ EOT
$repos = $installedRepo = new InstalledRepository([$rootRepo, $composer->getRepositoryManager()->getLocalRepository()]);
}
if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
if (!$installedRepo->getPackages()) {
$hasNonPlatformReqs = static function (array $reqs): bool {
return (bool) array_filter(array_keys($reqs), function (string $name) {
return !PlatformRepository::isPlatformPackage($name);
});
};
if ($hasNonPlatformReqs($rootPkg->getRequires()) || $hasNonPlatformReqs($rootPkg->getDevRequires())) {
$io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
}
}
}
if ($composer) {
$commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);

View File

@ -83,10 +83,10 @@ class VersionBumper
$pattern = '{
(?<=,|\ |\||^) # leading separator
(?P<constraint>
\^'.$major.'(?:\.\d+)* # e.g. ^2.anything
| ~'.$major.'(?:\.\d+){0,2} # e.g. ~2 or ~2.2 or ~2.2.2 but no more
| '.$major.'(?:\.[*x])+ # e.g. 2.* or 2.*.* or 2.x.x.x etc
| >=\d(?:\.\d+)* # e.g. >=2 or >=1.2 etc
\^v?'.$major.'(?:\.\d+)* # e.g. ^2.anything
| ~v?'.$major.'(?:\.\d+){0,2} # e.g. ~2 or ~2.2 or ~2.2.2 but no more
| v?'.$major.'(?:\.[*x])+ # e.g. 2.* or 2.*.* or 2.x.x.x etc
| >=v?\d(?:\.\d+)* # e.g. >=2 or >=1.2 etc
| \* # full wildcard
)
(?=,|$|\ |\||@) # trailing separator

View File

@ -190,6 +190,7 @@ class VersionSelector
*
* For example:
* * 1.2.1 -> ^1.2
* * 1.2.1.2 -> ^1.2
* * 1.2 -> ^1.2
* * v3.2.1 -> ^3.2
* * 2.0-beta.1 -> ^2.0@beta
@ -235,7 +236,7 @@ class VersionSelector
$semanticVersionParts = explode('.', $version);
// check to see if we have a semver-looking version
if (count($semanticVersionParts) === 4 && Preg::isMatch('{^0\D?}', $semanticVersionParts[3])) {
if (count($semanticVersionParts) === 4 && Preg::isMatch('{^\d+\D?}', $semanticVersionParts[3])) {
// remove the last parts (i.e. the patch version number and any extra)
if ($semanticVersionParts[0] === '0') {
unset($semanticVersionParts[3]);

View File

@ -76,7 +76,7 @@ class BumpCommandTest extends TestCase
yield 'bump all by default' => [
[
'require' => [
'first/pkg' => '^2.0',
'first/pkg' => '^v2.0',
'second/pkg' => '3.*',
],
'require-dev' => [

View File

@ -44,6 +44,7 @@ class VersionBumperTest extends TestCase
{
// constraint, version, expected recommendation, [branch-alias]
yield 'upgrade caret' => ['^1.0', '1.2.1', '^1.2.1'];
yield 'upgrade caret with v' => ['^v1.0', '1.2.1', '^1.2.1'];
yield 'skip trailing .0s' => ['^1.0', '1.0.0', '^1.0'];
yield 'skip trailing .0s/2' => ['^1.2', '1.2.0', '^1.2'];
yield 'preserve major.minor.patch format when installed minor is 0' => ['^1.0.0', '1.2.0', '^1.2.0'];
@ -58,6 +59,7 @@ class VersionBumperTest extends TestCase
yield 'dev version does not upgrade' => ['^3.2', 'dev-main', '^3.2'];
yield 'upgrade dev version if aliased' => ['^3.2', 'dev-main', '^3.3', '3.3.x-dev'];
yield 'upgrade major wildcard to caret' => ['2.*', '2.4.0', '^2.4'];
yield 'upgrade major wildcard to caret with v' => ['v2.*', '2.4.0', '^2.4'];
yield 'upgrade major wildcard as x to caret' => ['2.x', '2.4.0', '^2.4'];
yield 'upgrade major wildcard as x to caret/2' => ['2.x.x', '2.4.0', '^2.4.0'];
yield 'leave minor wildcard alone' => ['2.4.*', '2.4.3', '2.4.*'];
@ -66,6 +68,7 @@ class VersionBumperTest extends TestCase
yield 'update patch-only-tilde alone' => ['~2.2.3', '2.2.6', '~2.2.6'];
yield 'leave extra-only-tilde alone' => ['~2.2.3.1', '2.2.4.5', '~2.2.3.1'];
yield 'upgrade bigger-or-eq to latest' => ['>=3.0', '3.4.5', '>=3.4.5'];
yield 'upgrade bigger-or-eq to latest with v' => ['>=v3.0', '3.4.5', '>=3.4.5'];
yield 'leave bigger-than untouched' => ['>2.2.3', '2.2.6', '>2.2.3'];
yield 'upgrade full wildcard to bigger-or-eq' => ['*', '1.2.3', '>=1.2.3'];
}

View File

@ -346,6 +346,9 @@ class VersionSelectorTest extends TestCase
['0.1.3', '^0.1.3'],
['0.0.3', '^0.0.3'],
['0.0.3-alpha', '^0.0.3@alpha'],
['0.0.3.4-alpha', '^0.0.3@alpha'],
['3.0.0.2-RC2', '^3.0@RC'],
['1.2.1.1020402', '^1.2'],
// date-based versions are not touched at all
['v20121020', 'v20121020'],
['v20121020.2', 'v20121020.2'],