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

View File

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

View File

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

View File

@ -332,7 +332,12 @@ EOT
}
if ($input->getOption('path')) {
$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;
}
@ -509,7 +514,12 @@ EOT
$packageViewData['description'] = $package->getDescription();
}
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;
@ -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
{
@ -669,8 +679,8 @@ EOT
}
$io->write(' ' . $description, false);
}
if (isset($package['path'])) {
$io->write(' ' . $package['path'], false);
if (array_key_exists('path', $package)) {
$io->write(' '.(is_string($package['path']) ? $package['path'] : 'null'), false);
}
$io->write('');
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>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
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()));
@ -958,10 +973,15 @@ EOT
}
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) {
$json['path'] = $path;
}
} else {
$json['path'] = null;
}
}
if ($latestPackage instanceof CompletePackageInterface && $latestPackage->isAbandoned()) {

View File

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

View File

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

View File

@ -549,9 +549,9 @@ class InstallationManager
/**
* 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());

View File

@ -112,7 +112,7 @@ interface InstallerInterface
/**
* 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);
}

View File

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

View File

@ -124,9 +124,11 @@ class MetapackageInstaller implements InstallerInterface
/**
* @inheritDoc
*
* @return null
*/
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
*
* @return string path
* @return string configured install path
*/
public function getInstallPath(PackageInterface $package): string
{

View File

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

View File

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

View File

@ -236,8 +236,11 @@ class PluginManager
continue;
}
$downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
$autoloads[] = [$autoloadPackage, $downloadPath];
$installPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
if ($installPath === null) {
continue;
}
$autoloads[] = [$autoloadPackage, $installPath];
}
$map = $generator->parseAutoloads($autoloads, $rootPackage);
@ -524,9 +527,9 @@ class PluginManager
*
* @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) {
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\Dumper\ArrayDumper;
use Composer\Package\Link;
use Composer\Package\Version\VersionParser;
use Composer\Test\TestCase;
class ArrayLoaderTest extends TestCase
@ -249,6 +250,57 @@ class ArrayLoaderTest extends TestCase
$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
{
$config = [