1
0
Fork 0

Merge branch '2.5'

pull/11474/head
Jordi Boggiano 2023-05-23 16:25:24 +02:00
commit 24361ae654
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
15 changed files with 187 additions and 99 deletions

146
composer.lock generated
View File

@ -692,23 +692,23 @@
}, },
{ {
"name": "react/promise", "name": "react/promise",
"version": "v2.9.0", "version": "v2.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/promise.git", "url": "https://github.com/reactphp/promise.git",
"reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910" "reference": "f913fb8cceba1e6644b7b90c4bfb678ed8a3ef38"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/234f8fd1023c9158e2314fa9d7d0e6a83db42910", "url": "https://api.github.com/repos/reactphp/promise/zipball/f913fb8cceba1e6644b7b90c4bfb678ed8a3ef38",
"reference": "234f8fd1023c9158e2314fa9d7d0e6a83db42910", "reference": "f913fb8cceba1e6644b7b90c4bfb678ed8a3ef38",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.4.0" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.36" "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.36"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
@ -752,32 +752,28 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/promise/issues", "issues": "https://github.com/reactphp/promise/issues",
"source": "https://github.com/reactphp/promise/tree/v2.9.0" "source": "https://github.com/reactphp/promise/tree/v2.10.0"
}, },
"funding": [ "funding": [
{ {
"url": "https://github.com/WyriHaximus", "url": "https://opencollective.com/reactphp",
"type": "github" "type": "open_collective"
},
{
"url": "https://github.com/clue",
"type": "github"
} }
], ],
"time": "2022-02-11T10:27:51+00:00" "time": "2023-05-02T15:15:43+00:00"
}, },
{ {
"name": "seld/jsonlint", "name": "seld/jsonlint",
"version": "1.9.0", "version": "1.10.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Seldaek/jsonlint.git", "url": "https://github.com/Seldaek/jsonlint.git",
"reference": "4211420d25eba80712bff236a98960ef68b866b7" "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/4211420d25eba80712bff236a98960ef68b866b7", "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/594fd6462aad8ecee0b45ca5045acea4776667f1",
"reference": "4211420d25eba80712bff236a98960ef68b866b7", "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -816,7 +812,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/Seldaek/jsonlint/issues", "issues": "https://github.com/Seldaek/jsonlint/issues",
"source": "https://github.com/Seldaek/jsonlint/tree/1.9.0" "source": "https://github.com/Seldaek/jsonlint/tree/1.10.0"
}, },
"funding": [ "funding": [
{ {
@ -828,7 +824,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-04-01T13:37:23+00:00" "time": "2023-05-11T13:16:46+00:00"
}, },
{ {
"name": "seld/phar-utils", "name": "seld/phar-utils",
@ -941,16 +937,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v5.4.21", "version": "v5.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9" "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/c77433ddc6cdc689caf48065d9ea22ca0853fbd9", "url": "https://api.github.com/repos/symfony/console/zipball/90f21e27d0d88ce38720556dd164d4a1e4c3934c",
"reference": "c77433ddc6cdc689caf48065d9ea22ca0853fbd9", "reference": "90f21e27d0d88ce38720556dd164d4a1e4c3934c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1015,12 +1011,12 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"keywords": [ "keywords": [
"cli", "cli",
"command line", "command-line",
"console", "console",
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v5.4.21" "source": "https://github.com/symfony/console/tree/v5.4.23"
}, },
"funding": [ "funding": [
{ {
@ -1036,7 +1032,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-25T16:59:41+00:00" "time": "2023-04-24T18:47:29+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -1107,16 +1103,16 @@
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v5.4.21", "version": "v5.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f" "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", "url": "https://api.github.com/repos/symfony/filesystem/zipball/b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5",
"reference": "e75960b1bbfd2b8c9e483e0d74811d555ca3de9f", "reference": "b2f79d86cd9e7de0fff6d03baa80eaed7a5f38b5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1151,7 +1147,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.21" "source": "https://github.com/symfony/filesystem/tree/v5.4.23"
}, },
"funding": [ "funding": [
{ {
@ -1167,7 +1163,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-14T08:03:56+00:00" "time": "2023-03-02T11:38:35+00:00"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
@ -1805,16 +1801,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v5.4.21", "version": "v5.4.23",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd" "reference": "4b842fc4b61609e0a155a114082bd94e31e98287"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", "url": "https://api.github.com/repos/symfony/process/zipball/4b842fc4b61609e0a155a114082bd94e31e98287",
"reference": "d4ce417ebcb0b7d090b4c178ed6d3accc518e8bd", "reference": "4b842fc4b61609e0a155a114082bd94e31e98287",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1847,7 +1843,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.21" "source": "https://github.com/symfony/process/tree/v5.4.23"
}, },
"funding": [ "funding": [
{ {
@ -1863,7 +1859,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-21T19:46:44+00:00" "time": "2023-04-18T13:50:24+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
@ -1950,16 +1946,16 @@
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v5.4.21", "version": "v5.4.22",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f" "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/edac10d167b78b1d90f46a80320d632de0bd9f2f", "url": "https://api.github.com/repos/symfony/string/zipball/8036a4c76c0dd29e60b6a7cafcacc50cf088ea62",
"reference": "edac10d167b78b1d90f46a80320d632de0bd9f2f", "reference": "8036a4c76c0dd29e60b6a7cafcacc50cf088ea62",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2016,7 +2012,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v5.4.21" "source": "https://github.com/symfony/string/tree/v5.4.22"
}, },
"funding": [ "funding": [
{ {
@ -2032,22 +2028,22 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-22T08:00:55+00:00" "time": "2023-03-14T06:11:53+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.7", "version": "1.10.15",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975" "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b10ceb526d9607903c5b2673f1fc8775dbe48975", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/762c4dac4da6f8756eebb80e528c3a47855da9bd",
"reference": "b10ceb526d9607903c5b2673f1fc8775dbe48975", "reference": "762c4dac4da6f8756eebb80e528c3a47855da9bd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2096,7 +2092,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-03-16T15:24:20+00:00" "time": "2023-05-09T15:28:01+00:00"
}, },
{ {
"name": "phpstan/phpstan-deprecation-rules", "name": "phpstan/phpstan-deprecation-rules",
@ -2148,16 +2144,16 @@
}, },
{ {
"name": "phpstan/phpstan-phpunit", "name": "phpstan/phpstan-phpunit",
"version": "1.3.10", "version": "1.3.12",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-phpunit.git", "url": "https://github.com/phpstan/phpstan-phpunit.git",
"reference": "4cc5c6cc38e56bce7ea47c4091814e516d172dc3" "reference": "c44246879d692d3b2cf2a21d65be4b4715d6ef21"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/4cc5c6cc38e56bce7ea47c4091814e516d172dc3", "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/c44246879d692d3b2cf2a21d65be4b4715d6ef21",
"reference": "4cc5c6cc38e56bce7ea47c4091814e516d172dc3", "reference": "c44246879d692d3b2cf2a21d65be4b4715d6ef21",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2194,22 +2190,22 @@
"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.10" "source": "https://github.com/phpstan/phpstan-phpunit/tree/1.3.12"
}, },
"time": "2023-03-02T10:25:13+00:00" "time": "2023-05-23T11:58:47+00:00"
}, },
{ {
"name": "phpstan/phpstan-strict-rules", "name": "phpstan/phpstan-strict-rules",
"version": "1.5.0", "version": "1.5.1",
"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": "b7dd96a5503919a43b3cd06a2dced9d4252492f2" "reference": "b21c03d4f6f3a446e4311155f4be9d65048218e6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b7dd96a5503919a43b3cd06a2dced9d4252492f2", "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/b21c03d4f6f3a446e4311155f4be9d65048218e6",
"reference": "b7dd96a5503919a43b3cd06a2dced9d4252492f2", "reference": "b21c03d4f6f3a446e4311155f4be9d65048218e6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2243,28 +2239,28 @@
"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.5.0" "source": "https://github.com/phpstan/phpstan-strict-rules/tree/1.5.1"
}, },
"time": "2023-02-21T10:17:10+00:00" "time": "2023-03-29T14:47:40+00:00"
}, },
{ {
"name": "phpstan/phpstan-symfony", "name": "phpstan/phpstan-symfony",
"version": "1.2.23", "version": "1.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan-symfony.git", "url": "https://github.com/phpstan/phpstan-symfony.git",
"reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4" "reference": "7332b90dfc291ac5b4b83fbca2081936faa1e3f9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/8a8d0538ca943b20beda7e9799e14fb3683262d4", "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/7332b90dfc291ac5b4b83fbca2081936faa1e3f9",
"reference": "8a8d0538ca943b20beda7e9799e14fb3683262d4", "reference": "7332b90dfc291ac5b4b83fbca2081936faa1e3f9",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-simplexml": "*", "ext-simplexml": "*",
"php": "^7.2 || ^8.0", "php": "^7.2 || ^8.0",
"phpstan/phpstan": "^1.9.4" "phpstan/phpstan": "^1.9.18"
}, },
"conflict": { "conflict": {
"symfony/framework-bundle": "<3.0" "symfony/framework-bundle": "<3.0"
@ -2274,7 +2270,7 @@
"php-parallel-lint/php-parallel-lint": "^1.2", "php-parallel-lint/php-parallel-lint": "^1.2",
"phpstan/phpstan-phpunit": "^1.0", "phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0", "phpstan/phpstan-strict-rules": "^1.0",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^8.5.29 || ^9.5",
"psr/container": "1.0 || 1.1.1", "psr/container": "1.0 || 1.1.1",
"symfony/config": "^5.4 || ^6.1", "symfony/config": "^5.4 || ^6.1",
"symfony/console": "^5.4 || ^6.1", "symfony/console": "^5.4 || ^6.1",
@ -2314,22 +2310,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.23" "source": "https://github.com/phpstan/phpstan-symfony/tree/1.3.2"
}, },
"time": "2023-02-06T10:42:02+00:00" "time": "2023-05-16T12:46:15+00:00"
}, },
{ {
"name": "symfony/phpunit-bridge", "name": "symfony/phpunit-bridge",
"version": "v6.2.7", "version": "v6.2.10",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/phpunit-bridge.git", "url": "https://github.com/symfony/phpunit-bridge.git",
"reference": "56965fae0b6b8d271015990eff5240ffff02e185" "reference": "552950db2919421ad917e29e76d1999a2a31a8e3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/56965fae0b6b8d271015990eff5240ffff02e185", "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/552950db2919421ad917e29e76d1999a2a31a8e3",
"reference": "56965fae0b6b8d271015990eff5240ffff02e185", "reference": "552950db2919421ad917e29e76d1999a2a31a8e3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2383,7 +2379,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.7" "source": "https://github.com/symfony/phpunit-bridge/tree/v6.2.10"
}, },
"funding": [ "funding": [
{ {
@ -2399,7 +2395,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-02-16T09:57:23+00:00" "time": "2023-04-18T13:46:08+00:00"
} }
], ],
"aliases": [], "aliases": [],

View File

@ -157,9 +157,8 @@ source for the exact signature):
invoked with the update argument. invoked with the update argument.
* **uninstall()**, here you can determine the actions that need to be executed * **uninstall()**, here you can determine the actions that need to be executed
when the package needs to be removed. when the package needs to be removed.
* **getInstallPath()**, this method should return the location where the * **getInstallPath()**, this method should return the absolute path where the
package is to be installed, _relative from the location of composer.json._ package is to be installed. The path _must not end with a slash._
The path _must not end with a slash._
Example: Example:

View File

@ -485,10 +485,14 @@ EOF;
continue; continue;
} }
$this->validatePackage($package); $this->validatePackage($package);
$installPath = $installationManager->getInstallPath($package);
if ($installPath === null) {
continue;
}
$packageMap[] = [ $packageMap[] = [
$package, $package,
$installationManager->getInstallPath($package), $installPath,
]; ];
} }

View File

@ -332,7 +332,12 @@ EOT
} }
if ($input->getOption('path')) { if ($input->getOption('path')) {
$io->write($package->getName(), false); $io->write($package->getName(), false);
$io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n")); $path = $composer->getInstallationManager()->getInstallPath($package);
if (is_string($path)) {
$io->write(' ' . strtok(realpath($path), "\r\n"));
} else {
$io->write(' null');
}
return $exitCode; return $exitCode;
} }
@ -509,7 +514,12 @@ EOT
$packageViewData['description'] = $package->getDescription(); $packageViewData['description'] = $package->getDescription();
} }
if ($writePath) { if ($writePath) {
$packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"); $path = $composer->getInstallationManager()->getInstallPath($package);
if (is_string($path)) {
$packageViewData['path'] = strtok(realpath($path), "\r\n");
} else {
$packageViewData['path'] = null;
}
} }
$packageIsAbandoned = false; $packageIsAbandoned = false;
@ -635,7 +645,7 @@ EOT
} }
/** /**
* @param array<array{name: string, direct-dependency?: bool, version?: string, latest?: string, latest-status?: string, description?: string|null, path?: string, source?: string|null, homepage?: string|null, warning?: string, abandoned?: bool|string}> $packages * @param array<array{name: string, direct-dependency?: bool, version?: string, latest?: string, latest-status?: string, description?: string|null, path?: string|null, source?: string|null, homepage?: string|null, warning?: string, abandoned?: bool|string}> $packages
*/ */
private function printPackages(IOInterface $io, array $packages, string $indent, bool $writeVersion, bool $writeLatest, bool $writeDescription, int $width, int $versionLength, int $nameLength, int $latestLength): void private function printPackages(IOInterface $io, array $packages, string $indent, bool $writeVersion, bool $writeLatest, bool $writeDescription, int $width, int $versionLength, int $nameLength, int $latestLength): void
{ {
@ -669,8 +679,8 @@ EOT
} }
$io->write(' ' . $description, false); $io->write(' ' . $description, false);
} }
if (isset($package['path'])) { if (array_key_exists('path', $package)) {
$io->write(' ' . $package['path'], false); $io->write(' '.(is_string($package['path']) ? $package['path'] : 'null'), false);
} }
$io->write(''); $io->write('');
if (isset($package['warning'])) { if (isset($package['warning'])) {
@ -802,7 +812,12 @@ EOT
$io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference())); $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
$io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference())); $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
if ($installedRepo->hasPackage($package)) { if ($installedRepo->hasPackage($package)) {
$io->write('<info>path</info> : ' . sprintf('%s', realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package)))); $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
if (is_string($path)) {
$io->write('<info>path</info> : ' . realpath($path));
} else {
$io->write('<info>path</info> : null');
}
} }
$io->write('<info>names</info> : ' . implode(', ', $package->getNames())); $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
@ -958,10 +973,15 @@ EOT
} }
if ($installedRepo->hasPackage($package)) { if ($installedRepo->hasPackage($package)) {
$path = realpath($this->requireComposer()->getInstallationManager()->getInstallPath($package)); $path = $this->requireComposer()->getInstallationManager()->getInstallPath($package);
if (is_string($path)) {
$path = realpath($path);
if ($path !== false) { if ($path !== false) {
$json['path'] = $path; $json['path'] = $path;
} }
} else {
$json['path'] = null;
}
} }
if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) { if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {

View File

@ -99,6 +99,9 @@ EOT
foreach ($installedRepo->getCanonicalPackages() as $package) { foreach ($installedRepo->getCanonicalPackages() as $package) {
$downloader = $dm->getDownloaderForPackage($package); $downloader = $dm->getDownloaderForPackage($package);
$targetDir = $im->getInstallPath($package); $targetDir = $im->getInstallPath($package);
if ($targetDir === null) {
continue;
}
if ($downloader instanceof ChangeReportInterface) { if ($downloader instanceof ChangeReportInterface) {
if (is_link($targetDir)) { if (is_link($targetDir)) {

View File

@ -112,6 +112,9 @@ EOT
$localRepo = $composer->getRepositoryManager()->getLocalRepository(); $localRepo = $composer->getRepositoryManager()->getLocalRepository();
foreach ($localRepo->getPackages() as $package) { foreach ($localRepo->getPackages() as $package) {
$path = $composer->getInstallationManager()->getInstallPath($package); $path = $composer->getInstallationManager()->getInstallPath($package);
if (null === $path) {
continue;
}
$file = $path . '/composer.json'; $file = $path . '/composer.json';
if (is_dir($path) && file_exists($file)) { if (is_dir($path) && file_exists($file)) {
[$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion); [$errors, $publishErrors, $warnings] = $validator->validate($file, $checkAll, $checkVersion);

View File

@ -549,9 +549,9 @@ class InstallationManager
/** /**
* Returns the installation path of a package * Returns the installation path of a package
* *
* @return string path * @return string|null absolute path to install to, which does not end with a slash, or null if the package does not have anything installed on disk
*/ */
public function getInstallPath(PackageInterface $package): string public function getInstallPath(PackageInterface $package): ?string
{ {
$installer = $this->getInstaller($package->getType()); $installer = $this->getInstaller($package->getType());

View File

@ -112,7 +112,7 @@ interface InstallerInterface
/** /**
* Returns the absolute installation path of a package. * Returns the absolute installation path of a package.
* *
* @return string absolute path to install to, which MUST not end with a slash * @return string|null absolute path to install to, which MUST not end with a slash, or null if the package does not have anything installed on disk
*/ */
public function getInstallPath(PackageInterface $package); public function getInstallPath(PackageInterface $package);
} }

View File

@ -227,6 +227,8 @@ class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
/** /**
* @inheritDoc * @inheritDoc
*
* @return string
*/ */
public function getInstallPath(PackageInterface $package) public function getInstallPath(PackageInterface $package)
{ {

View File

@ -124,9 +124,11 @@ class MetapackageInstaller implements InstallerInterface
/** /**
* @inheritDoc * @inheritDoc
*
* @return null
*/ */
public function getInstallPath(PackageInterface $package) public function getInstallPath(PackageInterface $package)
{ {
return ''; return null;
} }
} }

View File

@ -115,7 +115,7 @@ class ProjectInstaller implements InstallerInterface
/** /**
* Returns the installation path of a package * Returns the installation path of a package
* *
* @return string path * @return string configured install path
*/ */
public function getInstallPath(PackageInterface $package): string public function getInstallPath(PackageInterface $package): string
{ {

View File

@ -455,7 +455,7 @@ class ArrayLoader implements LoaderInterface
if ( if (
isset($config['default-branch']) isset($config['default-branch'])
&& $config['default-branch'] === true && $config['default-branch'] === true
&& false === $this->versionParser->parseNumericAliasPrefix($config['version']) && false === $this->versionParser->parseNumericAliasPrefix(Preg::replace('{^v}', '', $config['version']))
) { ) {
return VersionParser::DEFAULT_BRANCH_ALIAS; return VersionParser::DEFAULT_BRANCH_ALIAS;
} }

View File

@ -473,7 +473,11 @@ class Locker
return null; return null;
} }
$path = realpath($this->installationManager->getInstallPath($package)); $path = $this->installationManager->getInstallPath($package);
if ($path === null) {
return null;
}
$path = realpath($path);
$sourceType = $package->getSourceType(); $sourceType = $package->getSourceType();
$datetime = null; $datetime = null;

View File

@ -236,8 +236,11 @@ class PluginManager
continue; continue;
} }
$downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage)); $installPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
$autoloads[] = [$autoloadPackage, $downloadPath]; if ($installPath === null) {
continue;
}
$autoloads[] = [$autoloadPackage, $installPath];
} }
$map = $generator->parseAutoloads($autoloads, $rootPackage); $map = $generator->parseAutoloads($autoloads, $rootPackage);
@ -524,9 +527,9 @@ class PluginManager
* *
* @param bool $global Whether this is a global package * @param bool $global Whether this is a global package
* *
* @return string Install path * @return string|null Install path
*/ */
private function getInstallPath(PackageInterface $package, bool $global = false): string private function getInstallPath(PackageInterface $package, bool $global = false): ?string
{ {
if (!$global) { if (!$global) {
return $this->composer->getInstallationManager()->getInstallPath($package); return $this->composer->getInstallationManager()->getInstallPath($package);

View File

@ -15,6 +15,7 @@ namespace Composer\Test\Package\Loader;
use Composer\Package\Loader\ArrayLoader; use Composer\Package\Loader\ArrayLoader;
use Composer\Package\Dumper\ArrayDumper; use Composer\Package\Dumper\ArrayDumper;
use Composer\Package\Link; use Composer\Package\Link;
use Composer\Package\Version\VersionParser;
use Composer\Test\TestCase; use Composer\Test\TestCase;
class ArrayLoaderTest extends TestCase class ArrayLoaderTest extends TestCase
@ -249,6 +250,57 @@ class ArrayLoaderTest extends TestCase
$this->assertEquals('4.x-dev', $package->getPrettyVersion()); $this->assertEquals('4.x-dev', $package->getPrettyVersion());
} }
public function testPackageAliasingWithoutBranchAlias(): void
{
// non-numeric gets a default alias
$config = [
'name' => 'A',
'version' => 'dev-main',
'default-branch' => true,
];
$package = $this->loader->load($config);
$this->assertInstanceOf('Composer\Package\AliasPackage', $package);
$this->assertEquals(VersionParser::DEFAULT_BRANCH_ALIAS, $package->getPrettyVersion());
// non-default branch gets no alias even if non-numeric
$config = [
'name' => 'A',
'version' => 'dev-main',
'default-branch' => false,
];
$package = $this->loader->load($config);
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
$this->assertEquals('dev-main', $package->getPrettyVersion());
// default branch gets no alias if already numeric
$config = [
'name' => 'A',
'version' => '2.x-dev',
'default-branch' => true,
];
$package = $this->loader->load($config);
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
$this->assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
// default branch gets no alias if already numeric, with v prefix
$config = [
'name' => 'A',
'version' => 'v2.x-dev',
'default-branch' => true,
];
$package = $this->loader->load($config);
$this->assertInstanceOf('Composer\Package\CompletePackage', $package);
$this->assertEquals('2.9999999.9999999.9999999-dev', $package->getVersion());
}
public function testAbandoned(): void public function testAbandoned(): void
{ {
$config = [ $config = [