1
0
Fork 0

Merge branch '2.5'

pull/11398/head
Jordi Boggiano 2023-03-21 10:45:40 +01:00
commit 5f298ae294
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
21 changed files with 227 additions and 254 deletions

142
composer.lock generated
View File

@ -941,16 +941,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.4.19", "version": "v5.4.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740" "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/dccb8d251a9017d5994c988b034d3e18aaabf740", "url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9",
"reference": "dccb8d251a9017d5994c988b034d3e18aaabf740", "reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1020,7 +1020,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.4.19" "source": "https://github.com/symfony/console/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1036,7 +1036,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-01T08:32:19+00:00" "time": "2023-02-25T16:59:41+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -1107,16 +1107,16 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v5.4.19", "version": "v5.4.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "648bfaca6a494f3e22378123bcee2894045dc9d8" "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/648bfaca6a494f3e22378123bcee2894045dc9d8", "url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f",
"reference": "648bfaca6a494f3e22378123bcee2894045dc9d8", "reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1151,7 +1151,7 @@
"description": "Provides basic utilities for the filesystem", "description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/filesystem/tree/v5.4.19" "source": "https://github.com/symfony/filesystem/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1167,20 +1167,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-14T19:14:44+00:00" "time": "2023-02-14T08:03:56+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v5.4.19", "version": "v5.4.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "6071aebf810ad13fe8200c224f36103abb37cf1f" "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/6071aebf810ad13fe8200c224f36103abb37cf1f", "url": "https://api.github.com/repos/symfony/finder/zipball/078e9a5e1871fcfe6a5ce421b539344c21afef19",
"reference": "6071aebf810ad13fe8200c224f36103abb37cf1f", "reference": "078e9a5e1871fcfe6a5ce421b539344c21afef19",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1214,7 +1214,7 @@
"description": "Finds files and directories via an intuitive fluent interface", "description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/finder/tree/v5.4.19" "source": "https://github.com/symfony/finder/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1230,7 +1230,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-14T19:14:44+00:00" "time": "2023-02-16T09:33:00+00:00"
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
@ -1805,16 +1805,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v5.4.19", "version": "v5.4.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1" "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/c5ba874c9b636dbccf761e22ce750e88ec3f55e1", "url": "https://api.github.com/repos/symfony/process/zipball/d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd",
"reference": "c5ba874c9b636dbccf761e22ce750e88ec3f55e1", "reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1847,7 +1847,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v5.4.19" "source": "https://github.com/symfony/process/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -1863,7 +1863,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-01T08:32:19+00:00" "time": "2023-02-21T19:46:44+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
@ -1950,16 +1950,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.4.19", "version": "v5.4.21",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "0a01071610fd861cc160dfb7e2682ceec66064cb" "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/0a01071610fd861cc160dfb7e2682ceec66064cb", "url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f",
"reference": "0a01071610fd861cc160dfb7e2682ceec66064cb", "reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2016,7 +2016,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.4.19" "source": "https://github.com/symfony/string/tree/v5.4.21"
}, },
"funding": [ "funding": [
{ {
@ -2032,22 +2032,22 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-01T08:32:19+00:00" "time": "2023-02-22T08:00:55+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.9.14", "version": "1.10.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "e5fcc96289cf737304286a9b505fbed091f02e58" "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975",
"reference": "e5fcc96289cf737304286a9b505fbed091f02e58", "reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2076,8 +2076,11 @@
"static analysis" "static analysis"
], ],
"support": { "support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues", "issues": "https://github.com/phpstan/phpstan/issues",
"source": "https://github.com/phpstan/phpstan/tree/1.9.14" "security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
}, },
"funding": [ "funding": [
{ {
@ -2093,25 +2096,25 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-19T10:47:09+00:00" "time": "2023-03-16T15:24:20+00:00"
}, },
{ {
"name": "phpstan/phpstan-deprecation-rules", "name": "phpstan/phpstan-deprecation-rules",
"version": "1.1.1", "version": "1.1.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-deprecation-rules.git", "url": "https://github.com/phpstan/phpstan-deprecation-rules.git",
"reference": "2c6792eda026d9c474c14aa018aed312686714db" "reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/2c6792eda026d9c474c14aa018aed312686714db", "url": "https://api.github.com/repos/phpstan/phpstan-deprecation-rules/zipball/a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
"reference": "2c6792eda026d9c474c14aa018aed312686714db", "reference": "a22b36b955a2e9a3d39fe533b6c1bb5359f9c319",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.3" "phpstan/phpstan": "^1.10"
}, },
"require-dev": { "require-dev": {
"php-parallel-lint/php-parallel-lint": "^1.2", "php-parallel-lint/php-parallel-lint": "^1.2",
@ -2139,27 +2142,27 @@
"description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.", "description": "PHPStan rules for detecting usage of deprecated classes, methods, properties, constants and traits.",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues", "issues": "https://github.com/phpstan/phpstan-deprecation-rules/issues",
"source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.1" "source": "https://github.com/phpstan/phpstan-deprecation-rules/tree/1.1.3"
}, },
"time": "2022-12-13T14:26:20+00:00" "time": "2023-03-17T07:50:08+00:00"
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
"version": "1.3.3", "version": "1.3.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git", "url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7" "reference": "4cc5c6cc38e56bce7ea47c4091814e516d172dc3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/54a24bd23e9e80ee918cdc24f909d376c2e273f7", "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4cc5c6cc38e56bce7ea47c4091814e516d172dc3",
"reference": "54a24bd23e9e80ee918cdc24f909d376c2e273f7", "reference": "4cc5c6cc38e56bce7ea47c4091814e516d172dc3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.3" "phpstan/phpstan": "^1.10"
}, },
"conflict": { "conflict": {
"phpunit/phpunit": "<7.0" "phpunit/phpunit": "<7.0"
@ -2191,31 +2194,32 @@
"description": "PHPUnit extensions and rules for PHPStan", "description": "PHPUnit extensions and rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-phpunit/issues", "issues": "https://github.com/phpstan/phpstan-phpunit/issues",
"source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.3" "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.10"
}, },
"time": "2022-12-21T15:25:00+00:00" "time": "2023-03-02T10:25:13+00:00"
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
"version": "1.4.5", "version": "1.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-strict-rules.git", "url": "https://github.com/phpstan/phpstan-strict-rules.git",
"reference": "361f75b06066f3fdaba87c1f57bdb1ffc28d6f1d" "reference": "b7dd96a5503919a43b3cd06a2dced9d4252492f2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/361f75b06066f3fdaba87c1f57bdb1ffc28d6f1d", "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b7dd96a5503919a43b3cd06a2dced9d4252492f2",
"reference": "361f75b06066f3fdaba87c1f57bdb1ffc28d6f1d", "reference": "b7dd96a5503919a43b3cd06a2dced9d4252492f2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.7" "phpstan/phpstan": "^1.10"
}, },
"require-dev": { "require-dev": {
"nikic/php-parser": "^4.13.0", "nikic/php-parser": "^4.13.0",
"php-parallel-lint/php-parallel-lint": "^1.2", "php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5" "phpunit/phpunit": "^9.5"
}, },
@ -2239,22 +2243,22 @@
"description": "Extra strict and opinionated rules for PHPStan", "description": "Extra strict and opinionated rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues", "issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.4.5" "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.5.0"
}, },
"time": "2023-01-11T14:16:29+00:00" "time": "2023-02-21T10:17:10+00:00"
}, },
{ {
"name": "phpstan/phpstan-symfony", "name": "phpstan/phpstan-symfony",
"version": "1.2.22", "version": "1.2.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-symfony.git", "url": "https://github.com/phpstan/phpstan-symfony.git",
"reference": "cbf5b9ceadab8365ed46db42dcd23db1a4c26c93" "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/cbf5b9ceadab8365ed46db42dcd23db1a4c26c93", "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/8a8d0538ca943b20beda7e9799e14fb3683262d4",
"reference": "cbf5b9ceadab8365ed46db42dcd23db1a4c26c93", "reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2310,22 +2314,22 @@
"description": "Symfony Framework extensions and rules for PHPStan", "description": "Symfony Framework extensions and rules for PHPStan",
"support": { "support": {
"issues": "https://github.com/phpstan/phpstan-symfony/issues", "issues": "https://github.com/phpstan/phpstan-symfony/issues",
"source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.22" "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.23"
}, },
"time": "2023-02-01T13:26:41+00:00" "time": "2023-02-06T10:42:02+00:00"
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "v6.2.5", "version": "v6.2.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git", "url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "d759e5372de414bef53a688c7aa7e240e4fd8aa2" "reference": "56965fae0b6b8d271015990eff5240ffff02e185"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/d759e5372de414bef53a688c7aa7e240e4fd8aa2", "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/56965fae0b6b8d271015990eff5240ffff02e185",
"reference": "d759e5372de414bef53a688c7aa7e240e4fd8aa2", "reference": "56965fae0b6b8d271015990eff5240ffff02e185",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2379,7 +2383,7 @@
"description": "Provides utilities for PHPUnit, especially user deprecation notices management", "description": "Provides utilities for PHPUnit, especially user deprecation notices management",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/phpunit-bridge/tree/v6.2.5" "source": "https://github.com/symfony/phpunit-bridge/tree/v6.2.7"
}, },
"funding": [ "funding": [
{ {
@ -2395,7 +2399,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-01-01T08:38:09+00:00" "time": "2023-02-16T09:57:23+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -240,11 +240,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Command/BaseDependencyCommand.php path: ../src/Composer/Command/BaseDependencyCommand.php
-
message: "#^Cannot access an offset on array\\<int, array\\<int, array\\<int, array\\<int, Composer\\\\Package\\\\Link\\>\\|Composer\\\\Package\\\\Link\\>\\|Composer\\\\Package\\\\Link\\>\\|Composer\\\\Package\\\\Link\\>\\|Composer\\\\Package\\\\Link\\.$#"
count: 1
path: ../src/Composer/Command/CheckPlatformReqsCommand.php
- -
message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\|null given\\.$#" message: "#^Only booleans are allowed in a negated boolean, Composer\\\\Semver\\\\Constraint\\\\ConstraintInterface\\|null given\\.$#"
count: 1 count: 1
@ -475,11 +470,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Command/InitCommand.php path: ../src/Composer/Command/InitCommand.php
-
message: "#^Left side of && is always false\\.$#"
count: 1
path: ../src/Composer/Command/InitCommand.php
- -
message: "#^Only booleans are allowed in a negated boolean, string given\\.$#" message: "#^Only booleans are allowed in a negated boolean, string given\\.$#"
count: 1 count: 1
@ -510,11 +500,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Command/InitCommand.php path: ../src/Composer/Command/InitCommand.php
-
message: "#^Right side of && is always false\\.$#"
count: 1
path: ../src/Composer/Command/InitCommand.php
- -
message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#" message: "#^Short ternary operator is not allowed\\. Use null coalesce operator if applicable or consider using long ternary\\.$#"
count: 7 count: 7
@ -552,11 +537,6 @@ parameters:
- -
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2
path: ../src/Composer/Command/RequireCommand.php
-
message: "#^Left side of && is always true\\.$#"
count: 1 count: 1
path: ../src/Composer/Command/RequireCommand.php path: ../src/Composer/Command/RequireCommand.php
@ -590,11 +570,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Command/RequireCommand.php path: ../src/Composer/Command/RequireCommand.php
-
message: "#^Right side of && is always true\\.$#"
count: 1
path: ../src/Composer/Command/RequireCommand.php
- -
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#" message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
count: 1 count: 1
@ -1085,16 +1060,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Config/JsonConfigSource.php path: ../src/Composer/Config/JsonConfigSource.php
-
message: "#^Call to function is_array\\(\\) with array\\<Composer\\\\Command\\\\BaseCommand\\> will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Console/Application.php
-
message: "#^Instanceof between Composer\\\\Command\\\\BaseCommand and Composer\\\\Command\\\\BaseCommand will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Console/Application.php
- -
message: "#^Only booleans are allowed in &&, array\\<string, array\\<int\\|string\\>\\|int\\|string\\> given on the left side\\.$#" message: "#^Only booleans are allowed in &&, array\\<string, array\\<int\\|string\\>\\|int\\|string\\> given on the left side\\.$#"
count: 1 count: 1
@ -1460,6 +1425,11 @@ parameters:
count: 2 count: 2
path: ../src/Composer/DependencyResolver/Solver.php path: ../src/Composer/DependencyResolver/Solver.php
-
message: "#^Method Composer\\\\DependencyResolver\\\\Solver\\:\\:enableDisableLearnedRules\\(\\) is unused\\.$#"
count: 1
path: ../src/Composer/DependencyResolver/Solver.php
- -
message: "#^Only booleans are allowed in &&, Composer\\\\DependencyResolver\\\\Rule\\|null given on the left side\\.$#" message: "#^Only booleans are allowed in &&, Composer\\\\DependencyResolver\\\\Rule\\|null given on the left side\\.$#"
count: 1 count: 1
@ -2030,11 +2000,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/EventDispatcher/EventDispatcher.php path: ../src/Composer/EventDispatcher/EventDispatcher.php
-
message: "#^Call to function is_callable\\(\\) with callable\\(\\)\\: mixed will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/EventDispatcher/EventDispatcher.php
- -
message: "#^Cannot access offset 0 on array\\{0\\: string, 1\\?\\: int\\}\\|int\\|string\\.$#" message: "#^Cannot access offset 0 on array\\{0\\: string, 1\\?\\: int\\}\\|int\\|string\\.$#"
count: 1 count: 1
@ -2180,11 +2145,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/IO/BaseIO.php path: ../src/Composer/IO/BaseIO.php
-
message: "#^Instanceof between Symfony\\\\Component\\\\Console\\\\Input\\\\StringInput and Symfony\\\\Component\\\\Console\\\\Input\\\\StreamableInputInterface will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/IO/BufferIO.php
- -
message: "#^Only booleans are allowed in a ternary operator condition, Symfony\\\\Component\\\\Console\\\\Formatter\\\\OutputFormatterInterface\\|null given\\.$#" message: "#^Only booleans are allowed in a ternary operator condition, Symfony\\\\Component\\\\Console\\\\Formatter\\\\OutputFormatterInterface\\|null given\\.$#"
count: 1 count: 1
@ -2240,16 +2200,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/InstalledVersions.php path: ../src/Composer/InstalledVersions.php
-
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 1
path: ../src/Composer/InstalledVersions.php
-
message: "#^Parameter \\#1 \\$constraints of method Composer\\\\Semver\\\\VersionParser\\:\\:parseConstraints\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: ../src/Composer/InstalledVersions.php
- -
message: "#^Cannot call method getPackages\\(\\) on Composer\\\\Repository\\\\LockArrayRepository\\|null\\.$#" message: "#^Cannot call method getPackages\\(\\) on Composer\\\\Repository\\\\LockArrayRepository\\|null\\.$#"
count: 1 count: 1
@ -2647,12 +2597,7 @@ parameters:
- -
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 4 count: 3
path: ../src/Composer/Package/Archiver/ArchiveManager.php
-
message: "#^Only booleans are allowed in an if condition, string\\|null given\\.$#"
count: 2
path: ../src/Composer/Package/Archiver/ArchiveManager.php path: ../src/Composer/Package/Archiver/ArchiveManager.php
- -
@ -3070,21 +3015,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Package/Version/VersionGuesser.php path: ../src/Composer/Package/Version/VersionGuesser.php
-
message: "#^Strict comparison using \\!\\=\\= between null and array\\{version\\: string\\|null, commit\\: '', pretty_version\\: string\\|null\\} will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Package/Version/VersionGuesser.php
-
message: "#^Strict comparison using \\!\\=\\= between null and array\\{version\\: string\\|null, commit\\: string\\|null, pretty_version\\: string\\|null, feature_version\\?\\: string\\|null, feature_pretty_version\\?\\: string\\|null\\} will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Package/Version/VersionGuesser.php
-
message: "#^Strict comparison using \\!\\=\\= between null and string will always evaluate to true\\.$#"
count: 1
path: ../src/Composer/Package/Version/VersionGuesser.php
- -
message: "#^Only booleans are allowed in an if condition, int\\<0, max\\>\\|false given\\.$#" message: "#^Only booleans are allowed in an if condition, int\\<0, max\\>\\|false given\\.$#"
count: 1 count: 1
@ -3120,11 +3050,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Platform/Runtime.php path: ../src/Composer/Platform/Runtime.php
-
message: "#^Casting to array\\<string\\> something that's already array\\<string\\>\\.$#"
count: 1
path: ../src/Composer/Plugin/PluginManager.php
- -
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 3 count: 3
@ -3205,11 +3130,6 @@ parameters:
count: 2 count: 2
path: ../src/Composer/Question/StrictConfirmationQuestion.php path: ../src/Composer/Question/StrictConfirmationQuestion.php
-
message: "#^Casting to array\\<string\\> something that's already array\\<string\\>\\.$#"
count: 1
path: ../src/Composer/Repository/ArrayRepository.php
- -
message: "#^Method Composer\\\\Repository\\\\ArrayRepository\\:\\:getProviders\\(\\) should return array\\<string, array\\{name\\: string, description\\: string, type\\: string\\}\\> but returns array\\<string, array\\{name\\: string, description\\: string\\|null, type\\: string\\}\\>\\.$#" message: "#^Method Composer\\\\Repository\\\\ArrayRepository\\:\\:getProviders\\(\\) should return array\\<string, array\\{name\\: string, description\\: string, type\\: string\\}\\> but returns array\\<string, array\\{name\\: string, description\\: string\\|null, type\\: string\\}\\>\\.$#"
count: 1 count: 1
@ -3415,11 +3335,6 @@ parameters:
count: 2 count: 2
path: ../src/Composer/Repository/FilesystemRepository.php path: ../src/Composer/Repository/FilesystemRepository.php
-
message: "#^Parameter \\#2 \\$content of method Composer\\\\Util\\\\Filesystem\\:\\:filePutContentsIfModified\\(\\) expects string, string\\|false given\\.$#"
count: 1
path: ../src/Composer/Repository/FilesystemRepository.php
- -
message: "#^Parameter \\#2 \\$installPaths of method Composer\\\\Repository\\\\FilesystemRepository\\:\\:generateInstalledVersions\\(\\) expects array\\<string, string\\>, array\\<string, string\\|null\\> given\\.$#" message: "#^Parameter \\#2 \\$installPaths of method Composer\\\\Repository\\\\FilesystemRepository\\:\\:generateInstalledVersions\\(\\) expects array\\<string, string\\>, array\\<string, string\\|null\\> given\\.$#"
count: 1 count: 1
@ -3978,11 +3893,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Repository/Vcs/SvnDriver.php path: ../src/Composer/Repository/Vcs/SvnDriver.php
-
message: "#^Strict comparison using \\!\\=\\= between string and false will always evaluate to true\\.$#"
count: 2
path: ../src/Composer/Repository/Vcs/SvnDriver.php
- -
message: "#^Cannot call method read\\(\\) on Composer\\\\Cache\\|null\\.$#" message: "#^Cannot call method read\\(\\) on Composer\\\\Cache\\|null\\.$#"
count: 1 count: 1
@ -4303,11 +4213,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Util/Http/CurlDownloader.php path: ../src/Composer/Util/Http/CurlDownloader.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2
path: ../src/Composer/Util/Http/CurlDownloader.php
- -
message: "#^Cannot access offset 'features' on array\\|false\\.$#" message: "#^Cannot access offset 'features' on array\\|false\\.$#"
count: 2 count: 2
@ -4998,11 +4903,6 @@ parameters:
count: 1 count: 1
path: ../src/Composer/Util/StreamContextFactory.php path: ../src/Composer/Util/StreamContextFactory.php
-
message: "#^Casting to bool something that's already \\*NEVER\\*\\.$#"
count: 1
path: ../src/Composer/Util/Svn.php
- -
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 2 count: 2
@ -5356,11 +5256,6 @@ parameters:
count: 1 count: 1
path: ../tests/Composer/Test/Installer/InstallerEventTest.php path: ../tests/Composer/Test/Installer/InstallerEventTest.php
-
message: "#^Call to function is_array\\(\\) with array\\<Composer\\\\Repository\\\\RepositoryInterface\\> will always evaluate to true\\.$#"
count: 1
path: ../tests/Composer/Test/InstallerTest.php
- -
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#" message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
count: 9 count: 9
@ -5511,11 +5406,6 @@ parameters:
count: 1 count: 1
path: ../tests/Composer/Test/Platform/VersionTest.php path: ../tests/Composer/Test/Platform/VersionTest.php
-
message: "#^Call to method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Composer\\\\\\\\Command…' and Composer\\\\Command\\\\BaseCommand will always evaluate to true\\.$#"
count: 1
path: ../tests/Composer/Test/Plugin/PluginInstallerTest.php
- -
message: "#^Parameter \\#2 \\$capabilityClassName of method Composer\\\\Plugin\\\\PluginManager\\:\\:getPluginCapability\\(\\) expects class\\-string\\<Composer\\\\Plugin\\\\Capability\\\\Capability\\>, string given\\.$#" message: "#^Parameter \\#2 \\$capabilityClassName of method Composer\\\\Plugin\\\\PluginManager\\:\\:getPluginCapability\\(\\) expects class\\-string\\<Composer\\\\Plugin\\\\Capability\\\\Capability\\>, string given\\.$#"
count: 2 count: 2

View File

@ -69,12 +69,10 @@ EOT
} }
} }
if (!$input->getOption('no-dev')) { if (!$input->getOption('no-dev')) {
$requires += $composer->getPackage()->getDevRequires(); foreach ($composer->getPackage()->getDevRequires() as $require => $link) {
}
foreach ($requires as $require => $link) {
$requires[$require] = [$link]; $requires[$require] = [$link];
} }
}
$installedRepo = new InstalledRepository([$installedRepo, new RootPackageRepository(clone $composer->getPackage())]); $installedRepo = new InstalledRepository([$installedRepo, new RootPackageRepository(clone $composer->getPackage())]);
foreach ($installedRepo->getPackages() as $package) { foreach ($installedRepo->getPackages() as $package) {

View File

@ -72,7 +72,7 @@ trait PackageDiscoveryTrait
// @phpstan-ignore-next-line as RequireCommand does not have the option above so this code is reachable there // @phpstan-ignore-next-line as RequireCommand does not have the option above so this code is reachable there
$file = Factory::getComposerFile(); $file = Factory::getComposerFile();
if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) { if (is_file($file) && Filesystem::isReadable($file) && is_array($composer = json_decode((string) file_get_contents($file), true))) {
if (!empty($composer['minimum-stability'])) { if (isset($composer['minimum-stability'])) {
return VersionParser::normalizeStability($composer['minimum-stability']); return VersionParser::normalizeStability($composer['minimum-stability']);
} }
} }

View File

@ -339,7 +339,7 @@ class Application extends BaseApplication
// Check system temp folder for usability as it can cause weird runtime issues otherwise // Check system temp folder for usability as it can cause weird runtime issues otherwise
Silencer::call(static function () use ($io): void { Silencer::call(static function () use ($io): void {
$tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime()); $tempfile = sys_get_temp_dir() . '/temp-' . getmypid() . '-' . md5(microtime());
if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) { if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) === __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
$io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir())); $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
} }

View File

@ -132,7 +132,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
$retries = 3; $retries = 3;
$distUrls = $package->getDistUrls(); $distUrls = $package->getDistUrls();
/** @var non-empty-array<array{base: non-empty-string, processed: non-empty-string, cacheKey: string}> $urls */ /** @var array<array{base: non-empty-string, processed: non-empty-string, cacheKey: string}> $urls */
$urls = []; $urls = [];
foreach ($distUrls as $index => $url) { foreach ($distUrls as $index => $url) {
$processedUrl = $this->processUrl($package, $url); $processedUrl = $this->processUrl($package, $url);
@ -146,6 +146,7 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
'cacheKey' => $cacheKeyGenerator($package, $processedUrl), 'cacheKey' => $cacheKeyGenerator($package, $processedUrl),
]; ];
} }
assert(count($urls) > 0);
$fileName = $this->getFileName($package, $path); $fileName = $this->getFileName($package, $path);
$this->filesystem->ensureDirectoryExists($path); $this->filesystem->ensureDirectoryExists($path);

View File

@ -98,7 +98,7 @@ class InstalledVersions
{ {
foreach (self::getInstalled() as $installed) { foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) { if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']); return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
} }
} }
@ -119,7 +119,7 @@ class InstalledVersions
*/ */
public static function satisfies(VersionParser $parser, $packageName, $constraint) public static function satisfies(VersionParser $parser, $packageName, $constraint)
{ {
$constraint = $parser->parseConstraints($constraint); $constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName)); $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint); return $provided->matches($constraint);
@ -328,7 +328,9 @@ class InstalledVersions
if (isset(self::$installedByVendor[$vendorDir])) { if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir]; $installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) { } elseif (is_file($vendorDir.'/composer/installed.php')) {
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1]; self::$installed = $installed[count($installed) - 1];
} }
@ -340,12 +342,17 @@ class InstalledVersions
// only require the installed.php file if this file is loaded from its dumped location, // only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') { if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = require __DIR__ . '/installed.php'; /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else { } else {
self::$installed = array(); self::$installed = array();
} }
} }
if (self::$installed !== array()) {
$installed[] = self::$installed; $installed[] = self::$installed;
}
return $installed; return $installed;
} }

View File

@ -38,7 +38,7 @@ class ZipArchiver implements ArchiverInterface
if ($res === true) { if ($res === true) {
$files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters); $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
foreach ($files as $file) { foreach ($files as $file) {
/** @var \SplFileInfo $file */ /** @var \Symfony\Component\Finder\SplFileInfo $file */
$filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/'); $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
$localname = $filepath; $localname = $filepath;
if (strpos($localname, $sources . '/') === 0) { if (strpos($localname, $sources . '/') === 0) {

View File

@ -76,7 +76,7 @@ class VersionGuesser
} }
$versionData = $this->guessGitVersion($packageConfig, $path); $versionData = $this->guessGitVersion($packageConfig, $path);
if (null !== $versionData && null !== $versionData['version']) { if (null !== $versionData['version']) {
return $this->postprocess($versionData); return $this->postprocess($versionData);
} }
@ -86,7 +86,7 @@ class VersionGuesser
} }
$versionData = $this->guessFossilVersion($path); $versionData = $this->guessFossilVersion($path);
if (null !== $versionData && null !== $versionData['version']) { if (null !== $versionData['version']) {
return $this->postprocess($versionData); return $this->postprocess($versionData);
} }

View File

@ -153,6 +153,9 @@ class GitBitbucketDriver extends VcsDriver
if ($composer !== null) { if ($composer !== null) {
// specials for bitbucket // specials for bitbucket
if (isset($composer['support']) && !is_array($composer['support'])) {
$composer['support'] = [];
}
if (!isset($composer['support']['source'])) { if (!isset($composer['support']['source'])) {
$label = array_search( $label = array_search(
$identifier, $identifier,

View File

@ -174,6 +174,9 @@ class GitHubDriver extends VcsDriver
if ($composer !== null) { if ($composer !== null) {
// specials for github // specials for github
if (isset($composer['support']) && !is_array($composer['support'])) {
$composer['support'] = [];
}
if (!isset($composer['support']['source'])) { if (!isset($composer['support']['source'])) {
$label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier; $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
$composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label); $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);

View File

@ -167,6 +167,9 @@ class GitLabDriver extends VcsDriver
if (null !== $composer) { if (null !== $composer) {
// specials for gitlab (this data is only available if authentication is provided) // specials for gitlab (this data is only available if authentication is provided)
if (isset($composer['support']) && !is_array($composer['support'])) {
$composer['support'] = [];
}
if (!isset($composer['support']['source']) && isset($this->project['web_url'])) { if (!isset($composer['support']['source']) && isset($this->project['web_url'])) {
$label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier; $label = array_search($identifier, $this->getTags(), true) ?: array_search($identifier, $this->getBranches(), true) ?: $identifier;
$composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label); $composer['support']['source'] = sprintf('%s/-/tree/%s', $this->project['web_url'], $label);

View File

@ -64,8 +64,8 @@ class Versions
public function setChannel(string $channel, ?IOInterface $io = null): void public function setChannel(string $channel, ?IOInterface $io = null): void
{ {
if (!in_array($channel, self::$channels, true)) { if (!in_array($channel, self::CHANNELS, true)) {
throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels)); throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::CHANNELS));
} }
$channelFile = $this->config->get('home').'/update-channel'; $channelFile = $this->config->get('home').'/update-channel';

View File

@ -161,15 +161,15 @@ class GitHub
foreach ($headers as $header) { foreach ($headers as $header) {
$header = trim($header); $header = trim($header);
if (false === strpos($header, 'X-RateLimit-')) { if (false === stripos($header, 'x-ratelimit-')) {
continue; continue;
} }
[$type, $value] = explode(':', $header, 2); [$type, $value] = explode(':', $header, 2);
switch ($type) { switch (strtolower($type)) {
case 'X-RateLimit-Limit': case 'x-ratelimit-limit':
$rateLimit['limit'] = (int) trim($value); $rateLimit['limit'] = (int) trim($value);
break; break;
case 'X-RateLimit-Reset': case 'x-ratelimit-reset':
$rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value)); $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
break; break;
} }
@ -206,7 +206,7 @@ class GitHub
public function isRateLimited(array $headers): bool public function isRateLimited(array $headers): bool
{ {
foreach ($headers as $header) { foreach ($headers as $header) {
if (Preg::isMatch('{^X-RateLimit-Remaining: *0$}i', trim($header))) { if (Preg::isMatch('{^x-ratelimit-remaining: *0$}i', trim($header))) {
return true; return true;
} }
} }
@ -224,7 +224,7 @@ class GitHub
public function requiresSso(array $headers): bool public function requiresSso(array $headers): bool
{ {
foreach ($headers as $header) { foreach ($headers as $header) {
if (Preg::isMatch('{^X-GitHub-SSO: required}i', trim($header))) { if (Preg::isMatch('{^x-github-sso: required}i', trim($header))) {
return true; return true;
} }
} }

View File

@ -407,7 +407,7 @@ class CurlDownloader
$result = $this->isAuthenticatedRetryNeeded($job, $response); $result = $this->isAuthenticatedRetryNeeded($job, $response);
if ($result['retry']) { if ($result['retry']) {
$this->restartJob($job, $job['url'], ['storeAuth' => $result['storeAuth']]); $this->restartJob($job, $job['url'], ['storeAuth' => $result['storeAuth'], 'retries' => $job['attributes']['retries'] + 1]);
continue; continue;
} }

View File

@ -102,9 +102,6 @@ class InstallerTest extends TestCase
$repositoryManager = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher); $repositoryManager = new RepositoryManager($io, $config, $httpDownloader, $eventDispatcher);
$repositoryManager->setLocalRepository(new InstalledArrayRepository()); $repositoryManager->setLocalRepository(new InstalledArrayRepository());
if (!is_array($repositories)) {
$repositories = [$repositories];
}
foreach ($repositories as $repository) { foreach ($repositories as $repository) {
$repositoryManager->addRepository($repository); $repositoryManager->addRepository($repository);
} }

View File

@ -63,7 +63,7 @@ class ProcessExecutorMock extends ProcessExecutor
*/ */
public function expects(array $expectations, bool $strict = false, array $defaultHandler = ['return' => 0, 'stdout' => '', 'stderr' => '']): void public function expects(array $expectations, bool $strict = false, array $defaultHandler = ['return' => 0, 'stdout' => '', 'stderr' => '']): void
{ {
/** @var array{cmd: string|list<string>, return: int, stdout: string, stderr: string, callback: callable} $default */ /** @var array{cmd: string|list<string>, return: int, stdout: string, stderr: string, callback: callable|null} $default */
$default = ['cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null]; $default = ['cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null];
$this->expectations = array_map(static function ($expect) use ($default): array { $this->expectations = array_map(static function ($expect) use ($default): array {
if (is_string($expect)) { if (is_string($expect)) {

View File

@ -14,6 +14,8 @@ namespace Composer\Test\Repository\Vcs;
use Composer\Config; use Composer\Config;
use Composer\Repository\Vcs\GitBitbucketDriver; use Composer\Repository\Vcs\GitBitbucketDriver;
use Composer\Repository\Vcs\GitHubDriver;
use Composer\Test\Mock\HttpDownloaderMock;
use Composer\Test\TestCase; use Composer\Test\TestCase;
use Composer\Util\Filesystem; use Composer\Util\Filesystem;
use Composer\Util\ProcessExecutor; use Composer\Util\ProcessExecutor;
@ -28,7 +30,7 @@ class GitBitbucketDriverTest extends TestCase
private $io; private $io;
/** @var Config */ /** @var Config */
private $config; private $config;
/** @var \Composer\Util\HttpDownloader&\PHPUnit\Framework\MockObject\MockObject */ /** @var HttpDownloaderMock */
private $httpDownloader; private $httpDownloader;
/** @var string */ /** @var string */
private $home; private $home;
@ -46,9 +48,7 @@ class GitBitbucketDriverTest extends TestCase
], ],
]); ]);
$this->httpDownloader = $this->getMockBuilder('Composer\Util\HttpDownloader') $this->httpDownloader = $this->getHttpDownloaderMock($this->io, $this->config);;
->disableOriginalConstructor()
->getMock();
} }
protected function tearDown(): void protected function tearDown(): void
@ -83,15 +83,9 @@ class GitBitbucketDriverTest extends TestCase
self::expectException('RuntimeException'); self::expectException('RuntimeException');
self::expectExceptionMessage('https://bitbucket.org/user/repo.git does not appear to be a git repository, use https://bitbucket.org/user/repo but remember that Bitbucket no longer supports the mercurial repositories. https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket'); self::expectExceptionMessage('https://bitbucket.org/user/repo.git does not appear to be a git repository, use https://bitbucket.org/user/repo but remember that Bitbucket no longer supports the mercurial repositories. https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket');
$this->httpDownloader->expects($this->once()) $this->httpDownloader->expects([
->method('get') ['url' => 'https://api.bitbucket.org/2.0/repositories/user/repo?fields=-project%2C-owner', 'body' => '{"scm":"hg","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/tags"},"clone":[{"href":"https:\/\/user@bitbucket.org\/user\/repo","name":"https"},{"href":"ssh:\/\/hg@bitbucket.org\/user\/repo","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/user\/repo"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false}']
->with( ], true);
$url = 'https://api.bitbucket.org/2.0/repositories/user/repo?fields=-project%2C-owner',
[]
)
->willReturn(
new Response(['url' => $url], 200, [], '{"scm":"hg","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/tags"},"clone":[{"href":"https:\/\/user@bitbucket.org\/user\/repo","name":"https"},{"href":"ssh:\/\/hg@bitbucket.org\/user\/repo","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/user\/repo"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false}')
);
$driver = $this->getDriver(['url' => 'https://bitbucket.org/user/repo.git']); $driver = $this->getDriver(['url' => 'https://bitbucket.org/user/repo.git']);
@ -109,32 +103,13 @@ class GitBitbucketDriverTest extends TestCase
'https://api.bitbucket.org/2.0/repositories/user/repo/src/main/composer.json', 'https://api.bitbucket.org/2.0/repositories/user/repo/src/main/composer.json',
'https://api.bitbucket.org/2.0/repositories/user/repo/commit/main?fields=date', 'https://api.bitbucket.org/2.0/repositories/user/repo/commit/main?fields=date',
]; ];
$this->httpDownloader->expects($this->any()) $this->httpDownloader->expects([
->method('get') ['url' => $urls[0], 'body' => '{"mainbranch": {"name": "main"}, "scm":"git","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/tags"},"clone":[{"href":"https:\/\/user@bitbucket.org\/user\/repo.git","name":"https"},{"href":"ssh:\/\/git@bitbucket.org\/user\/repo.git","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/user\/repo"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false}'],
->withConsecutive( ['url' => $urls[1], 'body' => '{"values":[{"name":"1.0.1","target":{"hash":"9b78a3932143497c519e49b8241083838c8ff8a1"}},{"name":"1.0.0","target":{"hash":"d3393d514318a9267d2f8ebbf463a9aaa389f8eb"}}]}'],
[ ['url' => $urls[2], 'body' => '{"values":[{"name":"main","target":{"hash":"937992d19d72b5116c3e8c4a04f960e5fa270b22"}}]}'],
$urls[0], [], ['url' => $urls[3], 'body' => '{"name": "user/repo","description": "test repo","license": "GPL","authors": [{"name": "Name","email": "local@domain.tld"}],"require": {"creator/package": "^1.0"},"require-dev": {"phpunit/phpunit": "~4.8"}}'],
], ['url' => $urls[4], 'body' => '{"date": "2016-05-17T13:19:52+00:00"}'],
[ ], true);
$urls[1], [],
],
[
$urls[2], [],
],
[
$urls[3], [],
],
[
$urls[4], [],
]
)
->willReturnOnConsecutiveCalls(
new Response(['url' => $urls[0]], 200, [], '{"mainbranch": {"name": "main"}, "scm":"git","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/tags"},"clone":[{"href":"https:\/\/user@bitbucket.org\/user\/repo.git","name":"https"},{"href":"ssh:\/\/git@bitbucket.org\/user\/repo.git","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/user\/repo"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false}'),
new Response(['url' => $urls[1]], 200, [], '{"values":[{"name":"1.0.1","target":{"hash":"9b78a3932143497c519e49b8241083838c8ff8a1"}},{"name":"1.0.0","target":{"hash":"d3393d514318a9267d2f8ebbf463a9aaa389f8eb"}}]}'),
new Response(['url' => $urls[2]], 200, [], '{"values":[{"name":"main","target":{"hash":"937992d19d72b5116c3e8c4a04f960e5fa270b22"}}]}'),
new Response(['url' => $urls[3]], 200, [], '{"name": "user/repo","description": "test repo","license": "GPL","authors": [{"name": "Name","email": "local@domain.tld"}],"require": {"creator/package": "^1.0"},"require-dev": {"phpunit/phpunit": "~4.8"}}'),
new Response(['url' => $urls[4]], 200, [], '{"date": "2016-05-17T13:19:52+00:00"}')
);
$this->assertEquals( $this->assertEquals(
'main', 'main',
@ -218,6 +193,34 @@ class GitBitbucketDriverTest extends TestCase
$driver->initialize(); $driver->initialize();
} }
public function testInvalidSupportData(): void
{
$repoUrl = 'https://bitbucket.org/user/repo.git';
$driver = $this->getDriver(['url' => $repoUrl]);
$urls = [
'https://api.bitbucket.org/2.0/repositories/user/repo?fields=-project%2C-owner',
'https://api.bitbucket.org/2.0/repositories/user/repo/src/main/composer.json',
'https://api.bitbucket.org/2.0/repositories/user/repo/commit/main?fields=date',
'https://api.bitbucket.org/2.0/repositories/user/repo/refs/tags?pagelen=100&fields=values.name%2Cvalues.target.hash%2Cnext&sort=-target.date',
'https://api.bitbucket.org/2.0/repositories/user/repo/refs/branches?pagelen=100&fields=values.name%2Cvalues.target.hash%2Cvalues.heads%2Cnext&sort=-target.date',
];
$this->httpDownloader->expects([
['url' => $urls[0], 'body' => '{"mainbranch": {"name": "main"}, "scm":"git","website":"","has_wiki":false,"name":"repo","links":{"branches":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/branches"},"tags":{"href":"https:\/\/api.bitbucket.org\/2.0\/repositories\/user\/repo\/refs\/tags"},"clone":[{"href":"https:\/\/user@bitbucket.org\/user\/repo.git","name":"https"},{"href":"ssh:\/\/git@bitbucket.org\/user\/repo.git","name":"ssh"}],"html":{"href":"https:\/\/bitbucket.org\/user\/repo"}},"language":"php","created_on":"2015-02-18T16:22:24.688+00:00","updated_on":"2016-05-17T13:20:21.993+00:00","is_private":true,"has_issues":false}'],
['url' => $urls[1], 'body' => '{"support": "' . $repoUrl . '"}'],
['url' => $urls[2], 'body' => '{"date": "2016-05-17T13:19:52+00:00"}'],
['url' => $urls[3], 'body' => '{"values":[{"name":"1.0.1","target":{"hash":"9b78a3932143497c519e49b8241083838c8ff8a1"}},{"name":"1.0.0","target":{"hash":"d3393d514318a9267d2f8ebbf463a9aaa389f8eb"}}]}'],
['url' => $urls[4], 'body' => '{"values":[{"name":"main","target":{"hash":"937992d19d72b5116c3e8c4a04f960e5fa270b22"}}]}'],
], true);
$driver->getRootIdentifier();
$data = $driver->getComposerInformation('main');
$this->assertIsArray($data);
$this->assertSame('https://bitbucket.org/user/repo/src/937992d19d72b5116c3e8c4a04f960e5fa270b22/?at=main', $data['support']['source']);
}
public function testSupports(): void public function testSupports(): void
{ {
$this->assertTrue( $this->assertTrue(

View File

@ -199,6 +199,44 @@ class GitHubDriverTest extends TestCase
$this->assertArrayNotHasKey('abandoned', $data); $this->assertArrayNotHasKey('abandoned', $data);
} }
public function testInvalidSupportData(): void
{
$repoUrl = 'http://github.com/composer/packagist';
$repoApiUrl = 'https://api.github.com/repos/composer/packagist';
$identifier = 'feature/3.2-foo';
$sha = 'SOMESHA';
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$io->expects($this->any())
->method('isInteractive')
->will($this->returnValue(true));
$httpDownloader = $this->getHttpDownloaderMock($io, $this->config);
$httpDownloader->expects(
[
['url' => $repoApiUrl, 'body' => '{"master_branch": "test_master", "owner": {"login": "composer"}, "name": "packagist"}'],
['url' => 'https://api.github.com/repos/composer/packagist/contents/composer.json?ref=feature%2F3.2-foo', 'body' => '{"encoding":"base64","content":"'.base64_encode('{"support": "'.$repoUrl.'" }').'"}'],
['url' => 'https://api.github.com/repos/composer/packagist/commits/feature%2F3.2-foo', 'body' => '{"commit": {"committer":{ "date": "2012-09-10"}}}'],
['url' => 'https://api.github.com/repos/composer/packagist/contents/.github/FUNDING.yml', 'body' => '{"encoding": "base64", "content": "'.base64_encode("custom: https://example.com").'"}'],
],
true
);
$repoConfig = [
'url' => $repoUrl,
];
$gitHubDriver = new GitHubDriver($repoConfig, $io, $this->config, $httpDownloader, $this->getProcessExecutorMock());
$gitHubDriver->initialize();
$this->setAttribute($gitHubDriver, 'tags', [$identifier => $sha]);
$this->setAttribute($gitHubDriver, 'branches', ['test_master' => $sha]);
$data = $gitHubDriver->getComposerInformation($identifier);
$this->assertIsArray($data);
$this->assertSame('https://github.com/composer/packagist/tree/feature/3.2-foo', $data['support']['source']);
}
public function testPublicRepositoryArchived(): void public function testPublicRepositoryArchived(): void
{ {
$repoUrl = 'http://github.com/composer/packagist'; $repoUrl = 'http://github.com/composer/packagist';

View File

@ -244,6 +244,22 @@ JSON;
$this->assertEquals($url, $driver->getUrl()); $this->assertEquals($url, $driver->getUrl());
} }
public function testInvalidSupportData(): void
{
$driver = $this->testInitialize($repoUrl = 'https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
$this->setAttribute($driver, 'branches', ['main' => 'SOMESHA']);
$this->setAttribute($driver, 'tags', []);
$this->httpDownloader->expects([
['url' => 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject/repository/files/composer%2Ejson/raw?ref=SOMESHA', 'body' => '{"support": "'.$repoUrl.'" }'],
], true);
$data = $driver->getComposerInformation('main');
$this->assertIsArray($data);
$this->assertSame('https://gitlab.com/mygroup/myproject/-/tree/main', $data['support']['source']);
}
public function testGetDist(): void public function testGetDist(): void
{ {
$driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject');
@ -631,4 +647,15 @@ JSON;
$driver->initialize(); $driver->initialize();
$this->assertEquals('https://gitlab.com/mygroup/myproject.git', $driver->getRepositoryUrl(), 'Repository URL matches config request for http not git'); $this->assertEquals('https://gitlab.com/mygroup/myproject.git', $driver->getRepositoryUrl(), 'Repository URL matches config request for http not git');
} }
/**
* @param object $object
* @param mixed $value
*/
protected function setAttribute($object, string $attribute, $value): void
{
$attr = new \ReflectionProperty($object, $attribute);
$attr->setAccessible(true);
$attr->setValue($object, $value);
}
} }

View File

@ -280,7 +280,6 @@ class RemoteFilesystemTest extends TestCase
*/ */
public function testBitBucketPublicDownload(string $url, string $contents): void public function testBitBucketPublicDownload(string $url, string $contents): void
{ {
/** @var ConsoleIO $io */
$io = $this $io = $this
->getMockBuilder('Composer\IO\ConsoleIO') ->getMockBuilder('Composer\IO\ConsoleIO')
->disableOriginalConstructor() ->disableOriginalConstructor()