From 5b754c797ea1a3bdf22bbace0272ebae4b2f926e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 31 Aug 2022 12:26:58 +0200 Subject: [PATCH 1/3] Remove extra lines --- src/Composer/Cache.php | 2 -- src/Composer/Command/BaseCommand.php | 1 - src/Composer/Compiler.php | 1 - src/Composer/Downloader/ArchiveDownloader.php | 2 -- src/Composer/Downloader/VcsDownloader.php | 3 --- src/Composer/IO/IOInterface.php | 1 - src/Composer/Installer.php | 2 -- src/Composer/Json/JsonFormatter.php | 1 - src/Composer/Package/Loader/RootPackageLoader.php | 1 - src/Composer/Package/Locker.php | 1 - src/Composer/Package/Package.php | 2 -- src/Composer/Package/PackageInterface.php | 1 - src/Composer/Plugin/PluginInterface.php | 3 --- src/Composer/Plugin/PluginManager.php | 6 ------ src/Composer/Util/Filesystem.php | 4 ---- src/Composer/Util/Http/ProxyHelper.php | 1 - src/Composer/Util/NoProxyPattern.php | 4 ---- tests/Composer/Test/TestCase.php | 2 -- tests/Composer/Test/Util/AuthHelperTest.php | 1 - 19 files changed, 39 deletions(-) diff --git a/src/Composer/Cache.php b/src/Composer/Cache.php index eddc402f2..8a5ab1a71 100644 --- a/src/Composer/Cache.php +++ b/src/Composer/Cache.php @@ -174,7 +174,6 @@ class Cache /** * Copy a file into the cache * - * * @return bool */ public function copyFrom(string $file, string $source) @@ -198,7 +197,6 @@ class Cache /** * Copy a file out of the cache * - * * @return bool */ public function copyTo(string $file, string $target) diff --git a/src/Composer/Command/BaseCommand.php b/src/Composer/Command/BaseCommand.php index b83fb00c4..a33f3a5b3 100644 --- a/src/Composer/Command/BaseCommand.php +++ b/src/Composer/Command/BaseCommand.php @@ -282,7 +282,6 @@ abstract class BaseCommand extends Command /** * Returns preferSource and preferDist values based on the configuration. * - * * @return bool[] An array composed of the preferSource and preferDist values */ protected function getPreferredInstallOptions(Config $config, InputInterface $input, bool $keepVcsRequiresPreferSource = false) diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 53c252b03..14449a13e 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -40,7 +40,6 @@ class Compiler * * @param string $pharFile The full path to the file to create * - * * @throws \RuntimeException */ public function compile(string $pharFile = 'composer.phar'): void diff --git a/src/Composer/Downloader/ArchiveDownloader.php b/src/Composer/Downloader/ArchiveDownloader.php index c31ac31ea..db8c04391 100644 --- a/src/Composer/Downloader/ArchiveDownloader.php +++ b/src/Composer/Downloader/ArchiveDownloader.php @@ -49,8 +49,6 @@ abstract class ArchiveDownloader extends FileDownloader /** * @inheritDoc * - * - * * @throws \RuntimeException * @throws \UnexpectedValueException */ diff --git a/src/Composer/Downloader/VcsDownloader.php b/src/Composer/Downloader/VcsDownloader.php index de67d16ee..15f3aeccd 100644 --- a/src/Composer/Downloader/VcsDownloader.php +++ b/src/Composer/Downloader/VcsDownloader.php @@ -258,7 +258,6 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa * @param bool $update if true (update) the changes can be stashed and reapplied after an update, * if false (remove) the changes should be assumed to be lost if the operation is not aborted * - * * @throws \RuntimeException in case the operation must be aborted */ protected function cleanChanges(PackageInterface $package, string $path, bool $update): PromiseInterface @@ -274,8 +273,6 @@ abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterfa /** * Reapply previously stashes changes if applicable, only called after an update (regardless if successful or not) * - * - * * @throws \RuntimeException in case the operation must be aborted or the patch does not apply cleanly */ protected function reapplyChanges(string $path): void diff --git a/src/Composer/IO/IOInterface.php b/src/Composer/IO/IOInterface.php index fb9906c08..91c239ff4 100644 --- a/src/Composer/IO/IOInterface.php +++ b/src/Composer/IO/IOInterface.php @@ -234,7 +234,6 @@ interface IOInterface extends LoggerInterface /** * Loads authentications from a config instance * - * * @return void */ public function loadConfiguration(Config $config); diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 09beafaea..38708c496 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -625,7 +625,6 @@ class Installer * * @param array> $aliases * - * * @phpstan-param list $aliases * @phpstan-return self::ERROR_* */ @@ -811,7 +810,6 @@ class Installer /** * @param array> $rootAliases * - * * @phpstan-param list $rootAliases */ private function createRepositorySet(bool $forUpdate, PlatformRepository $platformRepo, array $rootAliases = [], ?RepositoryInterface $lockedRepository = null): RepositorySet diff --git a/src/Composer/Json/JsonFormatter.php b/src/Composer/Json/JsonFormatter.php index 773ac886e..633d2c399 100644 --- a/src/Composer/Json/JsonFormatter.php +++ b/src/Composer/Json/JsonFormatter.php @@ -32,7 +32,6 @@ class JsonFormatter * * Originally licensed under MIT by Dave Perrett * - * * @param bool $unescapeUnicode Un escape unicode * @param bool $unescapeSlashes Un escape slashes */ diff --git a/src/Composer/Package/Loader/RootPackageLoader.php b/src/Composer/Package/Loader/RootPackageLoader.php index 588a72787..ffb553671 100644 --- a/src/Composer/Package/Loader/RootPackageLoader.php +++ b/src/Composer/Package/Loader/RootPackageLoader.php @@ -61,7 +61,6 @@ class RootPackageLoader extends ArrayLoader /** * @inheritDoc * - * * @return RootPackage|RootAliasPackage * * @phpstan-param class-string $class diff --git a/src/Composer/Package/Locker.php b/src/Composer/Package/Locker.php index e5c97cce0..4a7cb14c8 100644 --- a/src/Composer/Package/Locker.php +++ b/src/Composer/Package/Locker.php @@ -339,7 +339,6 @@ class Locker * @param array $platformOverrides * @param bool $write Whether to actually write data to disk, useful in tests and for --dry-run * - * * @phpstan-param list $aliases */ public function setLockData(array $packages, ?array $devPackages, array $platformReqs, array $platformDevReqs, array $aliases, string $minimumStability, array $stabilityFlags, bool $preferStable, bool $preferLowest, array $platformOverrides, bool $write = true): bool diff --git a/src/Composer/Package/Package.php b/src/Composer/Package/Package.php index dd6bf4986..76adb92bc 100644 --- a/src/Composer/Package/Package.php +++ b/src/Composer/Package/Package.php @@ -537,7 +537,6 @@ class Package extends BasePackage * * @param array $autoload Mapping of autoloading rules * - * * @phpstan-param AutoloadRules $autoload */ public function setAutoload(array $autoload): void @@ -558,7 +557,6 @@ class Package extends BasePackage * * @param array $devAutoload Mapping of dev autoloading rules * - * * @phpstan-param DevAutoloadRules $devAutoload */ public function setDevAutoload(array $devAutoload): void diff --git a/src/Composer/Package/PackageInterface.php b/src/Composer/Package/PackageInterface.php index c6196dafe..b65d570a1 100644 --- a/src/Composer/Package/PackageInterface.php +++ b/src/Composer/Package/PackageInterface.php @@ -234,7 +234,6 @@ interface PackageInterface /** * Returns the stability of this package: one of (dev, alpha, beta, RC, stable) * - * * @phpstan-return 'stable'|'RC'|'beta'|'alpha'|'dev' */ public function getStability(): string; diff --git a/src/Composer/Plugin/PluginInterface.php b/src/Composer/Plugin/PluginInterface.php index 51f22a061..8ceb4825d 100644 --- a/src/Composer/Plugin/PluginInterface.php +++ b/src/Composer/Plugin/PluginInterface.php @@ -37,7 +37,6 @@ interface PluginInterface /** * Apply plugin modifications to Composer * - * * @return void */ public function activate(Composer $composer, IOInterface $io); @@ -49,7 +48,6 @@ interface PluginInterface * uninstalled, but also before it gets upgraded to a new version * so the old one can be deactivated and the new one activated. * - * * @return void */ public function deactivate(Composer $composer, IOInterface $io); @@ -59,7 +57,6 @@ interface PluginInterface * * This will be called after deactivate. * - * * @return void */ public function uninstall(Composer $composer, IOInterface $io); diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 2a024d986..fbde18b00 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -148,7 +148,6 @@ class PluginManager * @param bool $failOnMissingClasses By default this silently skips plugins that can not be found, but if set to true it fails with an exception * @param bool $isGlobalPlugin Set to true to denote plugins which are installed in the global Composer directory * - * * @throws \UnexpectedValueException */ public function registerPackage(PackageInterface $package, bool $failOnMissingClasses = false, bool $isGlobalPlugin = false): void @@ -304,8 +303,6 @@ class PluginManager * If it's of type composer-installer it is unregistered from the installers * instead for BC * - * - * * @throws \UnexpectedValueException */ public function deactivatePackage(PackageInterface $package): void @@ -329,8 +326,6 @@ class PluginManager * If it's of type composer-installer it is unregistered from the installers * instead for BC * - * - * * @throws \UnexpectedValueException */ public function uninstallPackage(PackageInterface $package): void @@ -446,7 +441,6 @@ class PluginManager * * @param RepositoryInterface $repo Repository to scan for plugins to install * - * * @throws \RuntimeException */ private function loadRepository(RepositoryInterface $repo, bool $isGlobalRepo): void diff --git a/src/Composer/Util/Filesystem.php b/src/Composer/Util/Filesystem.php index 92cc0af11..419d62be4 100644 --- a/src/Composer/Util/Filesystem.php +++ b/src/Composer/Util/Filesystem.php @@ -324,7 +324,6 @@ class Filesystem * Some systems can't rename and also don't have proc_open, * which requires this solution. * - * * @return void */ public function copyThenRemove(string $source, string $target) @@ -716,7 +715,6 @@ class Filesystem /** * return true if that directory is a symlink. * - * * @return bool */ public function isSymlinkedDirectory(string $directory) @@ -762,7 +760,6 @@ class Filesystem /** * Creates an NTFS junction. * - * * @return void */ public function junction(string $target, string $junction) @@ -857,7 +854,6 @@ class Filesystem /** * Copy file using stream_copy_to_stream to work around https://bugs.php.net/bug.php?id=6463 * - * * @return void */ public function safeCopy(string $source, string $target) diff --git a/src/Composer/Util/Http/ProxyHelper.php b/src/Composer/Util/Http/ProxyHelper.php index be4711bf9..58056e429 100644 --- a/src/Composer/Util/Http/ProxyHelper.php +++ b/src/Composer/Util/Http/ProxyHelper.php @@ -60,7 +60,6 @@ class ProxyHelper /** * Returns http context options for the proxy url * - * * @return array{http: array{proxy: string, header?: string}} */ public static function getContextOptions(string $proxyUrl): array diff --git a/src/Composer/Util/NoProxyPattern.php b/src/Composer/Util/NoProxyPattern.php index ebba75369..45f47343e 100644 --- a/src/Composer/Util/NoProxyPattern.php +++ b/src/Composer/Util/NoProxyPattern.php @@ -69,7 +69,6 @@ class NoProxyPattern /** * Returns false is the url cannot be parsed, otherwise a data object * - * * @return bool|stdClass */ protected function getUrlData(string $url) @@ -165,7 +164,6 @@ class NoProxyPattern /** * Finds or creates rule data for a hostname * - * * @return null|stdClass Null if the hostname is invalid */ private function getRule(int $index, string $hostName): ?stdClass @@ -239,7 +237,6 @@ class NoProxyPattern * IPv4 addresses are always mapped to IPv6, which simplifies handling * and comparison. * - * * @return mixed[] in_addr, size */ private function ipGetAddr(string $host): array @@ -355,7 +352,6 @@ class NoProxyPattern /** * Splits the hostname into host and port components * - * * @return mixed[] host, port, if there was error */ private function splitHostPort(string $hostName): array diff --git a/tests/Composer/Test/TestCase.php b/tests/Composer/Test/TestCase.php index 0b2121114..9d0aae57a 100644 --- a/tests/Composer/Test/TestCase.php +++ b/tests/Composer/Test/TestCase.php @@ -308,7 +308,6 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase * * @param string $executableName The name of the binary to test. * - * * @throws \PHPUnit\Framework\SkippedTestError */ protected function skipIfNotExecutable(string $executableName): void @@ -326,7 +325,6 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase /** * Transforms an escaped non-Windows command to match Windows escaping. * - * * @return string The transformed command */ protected function getCmd(string $cmd): string diff --git a/tests/Composer/Test/Util/AuthHelperTest.php b/tests/Composer/Test/Util/AuthHelperTest.php index a23e985a8..4f1495d68 100644 --- a/tests/Composer/Test/Util/AuthHelperTest.php +++ b/tests/Composer/Test/Util/AuthHelperTest.php @@ -541,7 +541,6 @@ class AuthHelperTest extends TestCase /** * @param array $auth * - * * @phpstan-param array{username: string|null, password: string|null} $auth */ private function expectsAuthentication(string $origin, array $auth): void From 554914923d265dee5c7d7b664fe6ec4bce58a568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Mirtes?= Date: Mon, 22 Aug 2022 15:00:18 +0200 Subject: [PATCH 2/3] Tests bootstrap - require InstalledVersions only if it's not declared yet (#11014) --- tests/bootstrap.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index e4fa7fa3c..010ded939 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -10,6 +10,7 @@ * file that was distributed with this source code. */ +use Composer\InstalledVersions; use Composer\Util\Platform; error_reporting(E_ALL); @@ -19,7 +20,11 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul } require __DIR__.'/../src/bootstrap.php'; -require __DIR__.'/../src/Composer/InstalledVersions.php'; + +if (!class_exists(InstalledVersions::class, false)) { + require __DIR__.'/../src/Composer/InstalledVersions.php'; +} + require __DIR__.'/Composer/Test/TestCase.php'; Platform::putEnv('COMPOSER_TESTS_ARE_RUNNING', '1'); From 8856a01e5b1a57584cc3f1af52745ea7b0da766e Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 31 Aug 2022 12:41:43 +0200 Subject: [PATCH 3/3] Update deps --- composer.lock | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/composer.lock b/composer.lock index a6764fb6f..5cca60e1d 100644 --- a/composer.lock +++ b/composer.lock @@ -832,16 +832,16 @@ }, { "name": "seld/phar-utils", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "9f3452c93ff423469c0d56450431562ca423dcee" + "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/9f3452c93ff423469c0d56450431562ca423dcee", - "reference": "9f3452c93ff423469c0d56450431562ca423dcee", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/ea2f4014f163c1be4c601b9b7bd6af81ba8d701c", + "reference": "ea2f4014f163c1be4c601b9b7bd6af81ba8d701c", "shasum": "" }, "require": { @@ -874,9 +874,9 @@ ], "support": { "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.2.0" + "source": "https://github.com/Seldaek/phar-utils/tree/1.2.1" }, - "time": "2021-12-10T11:20:11+00:00" + "time": "2022-08-31T10:31:18+00:00" }, { "name": "seld/signal-handler", @@ -941,16 +941,16 @@ }, { "name": "symfony/console", - "version": "v5.4.11", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "535846c7ee6bc4dd027ca0d93220601456734b10" + "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/535846c7ee6bc4dd027ca0d93220601456734b10", - "reference": "535846c7ee6bc4dd027ca0d93220601456734b10", + "url": "https://api.github.com/repos/symfony/console/zipball/c072aa8f724c3af64e2c7a96b796a4863d24dba1", + "reference": "c072aa8f724c3af64e2c7a96b796a4863d24dba1", "shasum": "" }, "require": { @@ -1020,7 +1020,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.11" + "source": "https://github.com/symfony/console/tree/v5.4.12" }, "funding": [ { @@ -1036,7 +1036,7 @@ "type": "tidelift" } ], - "time": "2022-07-22T10:42:43+00:00" + "time": "2022-08-17T13:18:05+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1107,16 +1107,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.4.11", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "6699fb0228d1bc35b12aed6dd5e7455457609ddd" + "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/6699fb0228d1bc35b12aed6dd5e7455457609ddd", - "reference": "6699fb0228d1bc35b12aed6dd5e7455457609ddd", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/2d67c1f9a1937406a9be3171b4b22250c0a11447", + "reference": "2d67c1f9a1937406a9be3171b4b22250c0a11447", "shasum": "" }, "require": { @@ -1151,7 +1151,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.11" + "source": "https://github.com/symfony/filesystem/tree/v5.4.12" }, "funding": [ { @@ -1167,7 +1167,7 @@ "type": "tidelift" } ], - "time": "2022-07-20T13:00:38+00:00" + "time": "2022-08-02T13:48:16+00:00" }, { "name": "symfony/finder", @@ -1871,16 +1871,16 @@ }, { "name": "symfony/string", - "version": "v5.4.11", + "version": "v5.4.12", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322" + "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/5eb661e49ad389e4ae2b6e4df8d783a8a6548322", - "reference": "5eb661e49ad389e4ae2b6e4df8d783a8a6548322", + "url": "https://api.github.com/repos/symfony/string/zipball/2fc515e512d721bf31ea76bd02fe23ada4640058", + "reference": "2fc515e512d721bf31ea76bd02fe23ada4640058", "shasum": "" }, "require": { @@ -1937,7 +1937,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.11" + "source": "https://github.com/symfony/string/tree/v5.4.12" }, "funding": [ { @@ -1953,7 +1953,7 @@ "type": "tidelift" } ], - "time": "2022-07-24T16:15:25+00:00" + "time": "2022-08-12T17:03:11+00:00" } ], "packages-dev": [