diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index a5f4be066..e2c430166 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -71,7 +71,6 @@ return $config->setRules([ 'random_api_migration' => true, 'ternary_to_null_coalescing' => true, //'declare_strict_types' => true, - //'void_return' => true, ]) ->setUsingCache(true) ->setRiskyAllowed(true) diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index cb948945f..9d0c73f1f 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -38,7 +38,7 @@ class ClassMapGenerator * @param string $file The name of the class map file * @return void */ - public static function dump($dirs, $file) + public static function dump($dirs, $file): void { $maps = array(); diff --git a/src/Composer/Autoload/PhpFileCleaner.php b/src/Composer/Autoload/PhpFileCleaner.php index 7941f463c..17341a935 100644 --- a/src/Composer/Autoload/PhpFileCleaner.php +++ b/src/Composer/Autoload/PhpFileCleaner.php @@ -51,7 +51,7 @@ class PhpFileCleaner * @param string[] $types * @return void */ - public static function setTypeConfig($types) + public static function setTypeConfig($types): void { foreach ($types as $type) { self::$typeConfig[$type[0]] = array( @@ -152,7 +152,7 @@ class PhpFileCleaner /** * @return void */ - private function skipToPhp() + private function skipToPhp(): void { while ($this->index < $this->len) { if ($this->contents[$this->index] === '<' && $this->peek('?')) { @@ -168,7 +168,7 @@ class PhpFileCleaner * @param string $delimiter * @return void */ - private function skipString($delimiter) + private function skipString($delimiter): void { $this->index += 1; while ($this->index < $this->len) { @@ -187,7 +187,7 @@ class PhpFileCleaner /** * @return void */ - private function skipComment() + private function skipComment(): void { $this->index += 2; while ($this->index < $this->len) { @@ -203,7 +203,7 @@ class PhpFileCleaner /** * @return void */ - private function skipToNewline() + private function skipToNewline(): void { while ($this->index < $this->len) { if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") { @@ -217,7 +217,7 @@ class PhpFileCleaner * @param string $delimiter * @return void */ - private function skipHeredoc($delimiter) + private function skipHeredoc($delimiter): void { $firstDelimiterChar = $delimiter[0]; $delimiterLength = \strlen($delimiter); diff --git a/src/Composer/Command/AboutCommand.php b/src/Composer/Command/AboutCommand.php index 18b0db279..80d9a9caa 100644 --- a/src/Composer/Command/AboutCommand.php +++ b/src/Composer/Command/AboutCommand.php @@ -24,7 +24,7 @@ class AboutCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('about') diff --git a/src/Composer/Command/ArchiveCommand.php b/src/Composer/Command/ArchiveCommand.php index beaa65a77..314c06554 100644 --- a/src/Composer/Command/ArchiveCommand.php +++ b/src/Composer/Command/ArchiveCommand.php @@ -41,7 +41,7 @@ class ArchiveCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('archive') diff --git a/src/Composer/Command/BaseDependencyCommand.php b/src/Composer/Command/BaseDependencyCommand.php index 4b24202ed..3cd693370 100644 --- a/src/Composer/Command/BaseDependencyCommand.php +++ b/src/Composer/Command/BaseDependencyCommand.php @@ -136,7 +136,7 @@ class BaseDependencyCommand extends BaseCommand * * @return void */ - protected function printTable(OutputInterface $output, $results) + protected function printTable(OutputInterface $output, $results): void { $table = array(); $doubles = array(); @@ -172,7 +172,7 @@ class BaseDependencyCommand extends BaseCommand * * @return void */ - protected function initStyles(OutputInterface $output) + protected function initStyles(OutputInterface $output): void { $this->colors = array( 'green', @@ -197,7 +197,7 @@ class BaseDependencyCommand extends BaseCommand * * @return void */ - protected function printTree($results, $prefix = '', $level = 1) + protected function printTree($results, $prefix = '', $level = 1): void { $count = count($results); $idx = 0; @@ -223,7 +223,7 @@ class BaseDependencyCommand extends BaseCommand * * @return void */ - private function writeTreeLine($line) + private function writeTreeLine($line): void { $io = $this->getIO(); if (!$io->isDecorated()) { diff --git a/src/Composer/Command/CheckPlatformReqsCommand.php b/src/Composer/Command/CheckPlatformReqsCommand.php index d86dec5da..8e525e7bf 100644 --- a/src/Composer/Command/CheckPlatformReqsCommand.php +++ b/src/Composer/Command/CheckPlatformReqsCommand.php @@ -26,7 +26,7 @@ class CheckPlatformReqsCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this->setName('check-platform-reqs') ->setDescription('Check that platform requirements are satisfied.') @@ -174,7 +174,7 @@ EOT * * @return void */ - protected function printTable(OutputInterface $output, $results) + protected function printTable(OutputInterface $output, $results): void { $rows = array(); foreach ($results as $result) { diff --git a/src/Composer/Command/ClearCacheCommand.php b/src/Composer/Command/ClearCacheCommand.php index 015a49b6f..e7c15de31 100644 --- a/src/Composer/Command/ClearCacheCommand.php +++ b/src/Composer/Command/ClearCacheCommand.php @@ -25,7 +25,7 @@ class ClearCacheCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('clear-cache') diff --git a/src/Composer/Command/ConfigCommand.php b/src/Composer/Command/ConfigCommand.php index 8b67042fe..9071f3b92 100644 --- a/src/Composer/Command/ConfigCommand.php +++ b/src/Composer/Command/ConfigCommand.php @@ -62,7 +62,7 @@ class ConfigCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('config') @@ -154,7 +154,7 @@ EOT * @return void * @throws \Exception */ - protected function initialize(InputInterface $input, OutputInterface $output) + protected function initialize(InputInterface $input, OutputInterface $output): void { parent::initialize($input, $output); @@ -810,7 +810,7 @@ EOT * * @return void */ - protected function handleSingleValue($key, array $callbacks, array $values, $method) + protected function handleSingleValue($key, array $callbacks, array $values, $method): void { list($validator, $normalizer) = $callbacks; if (1 !== count($values)) { @@ -845,7 +845,7 @@ EOT * * @return void */ - protected function handleMultiValue($key, array $callbacks, array $values, $method) + protected function handleMultiValue($key, array $callbacks, array $values, $method): void { list($validator, $normalizer) = $callbacks; if (true !== $validation = $validator($values)) { @@ -868,7 +868,7 @@ EOT * * @return void */ - protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null, $showSource = false) + protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null, $showSource = false): void { $origK = $k; $io = $this->getIO(); diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index 5a270a81c..5d6ce71bd 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -63,7 +63,7 @@ class CreateProjectCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('create-project') @@ -443,7 +443,7 @@ EOT @mkdir($directory, 0777, true); if ($realDir = realpath($directory)) { pcntl_async_signals(true); - pcntl_signal(SIGINT, function () use ($realDir) { + pcntl_signal(SIGINT, function () use ($realDir): void { $fs = new Filesystem(); $fs->removeDirectory($realDir); exit(130); @@ -454,7 +454,7 @@ EOT if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') { @mkdir($directory, 0777, true); if ($realDir = realpath($directory)) { - sapi_windows_set_ctrl_handler(function () use ($realDir) { + sapi_windows_set_ctrl_handler(function () use ($realDir): void { $fs = new Filesystem(); $fs->removeDirectory($realDir); exit(130); diff --git a/src/Composer/Command/DependsCommand.php b/src/Composer/Command/DependsCommand.php index dfd8d716b..54fda17a5 100644 --- a/src/Composer/Command/DependsCommand.php +++ b/src/Composer/Command/DependsCommand.php @@ -27,7 +27,7 @@ class DependsCommand extends BaseDependencyCommand * * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('depends') diff --git a/src/Composer/Command/FundCommand.php b/src/Composer/Command/FundCommand.php index 6e551a66a..5d397f058 100644 --- a/src/Composer/Command/FundCommand.php +++ b/src/Composer/Command/FundCommand.php @@ -33,7 +33,7 @@ class FundCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this->setName('fund') ->setDescription('Discover how to help fund the maintenance of your dependencies.') diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index 91aae03f0..074bc283c 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -29,7 +29,7 @@ class GlobalCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('global') diff --git a/src/Composer/Command/HomeCommand.php b/src/Composer/Command/HomeCommand.php index a44546c55..eaab9fdab 100644 --- a/src/Composer/Command/HomeCommand.php +++ b/src/Composer/Command/HomeCommand.php @@ -33,7 +33,7 @@ class HomeCommand extends BaseCommand * * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('browse') @@ -128,7 +128,7 @@ EOT * @param string $url * @return void */ - private function openBrowser($url) + private function openBrowser($url): void { $url = ProcessExecutor::escape($url); diff --git a/src/Composer/Command/LicensesCommand.php b/src/Composer/Command/LicensesCommand.php index 5a9bfa16b..de51bba87 100644 --- a/src/Composer/Command/LicensesCommand.php +++ b/src/Composer/Command/LicensesCommand.php @@ -34,7 +34,7 @@ class LicensesCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('licenses') diff --git a/src/Composer/Command/OutdatedCommand.php b/src/Composer/Command/OutdatedCommand.php index bdf60f664..af62009bd 100644 --- a/src/Composer/Command/OutdatedCommand.php +++ b/src/Composer/Command/OutdatedCommand.php @@ -26,7 +26,7 @@ class OutdatedCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('outdated') diff --git a/src/Composer/Command/ProhibitsCommand.php b/src/Composer/Command/ProhibitsCommand.php index 304b116e2..59165f4de 100644 --- a/src/Composer/Command/ProhibitsCommand.php +++ b/src/Composer/Command/ProhibitsCommand.php @@ -27,7 +27,7 @@ class ProhibitsCommand extends BaseDependencyCommand * * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('prohibits') diff --git a/src/Composer/Command/ReinstallCommand.php b/src/Composer/Command/ReinstallCommand.php index 7b8a00873..18c8e4560 100644 --- a/src/Composer/Command/ReinstallCommand.php +++ b/src/Composer/Command/ReinstallCommand.php @@ -35,7 +35,7 @@ class ReinstallCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('reinstall') diff --git a/src/Composer/Command/RunScriptCommand.php b/src/Composer/Command/RunScriptCommand.php index f35688c15..64a00bc64 100644 --- a/src/Composer/Command/RunScriptCommand.php +++ b/src/Composer/Command/RunScriptCommand.php @@ -47,7 +47,7 @@ class RunScriptCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('run-script') diff --git a/src/Composer/Command/ScriptAliasCommand.php b/src/Composer/Command/ScriptAliasCommand.php index 801068c9a..2c98c9a66 100644 --- a/src/Composer/Command/ScriptAliasCommand.php +++ b/src/Composer/Command/ScriptAliasCommand.php @@ -42,7 +42,7 @@ class ScriptAliasCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName($this->script) diff --git a/src/Composer/Command/SearchCommand.php b/src/Composer/Command/SearchCommand.php index 9a404482f..496394a30 100644 --- a/src/Composer/Command/SearchCommand.php +++ b/src/Composer/Command/SearchCommand.php @@ -33,7 +33,7 @@ class SearchCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('search') diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index af8d511e7..b473658b1 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -42,7 +42,7 @@ class SelfUpdateCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('self-update') @@ -346,7 +346,7 @@ TAGSPUBKEY * @return void * @throws \Exception */ - protected function fetchKeys(IOInterface $io, Config $config) + protected function fetchKeys(IOInterface $io, Config $config): void { if (!$io->isInteractive()) { throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively'); @@ -483,7 +483,7 @@ TAGSPUBKEY * * @return void */ - protected function cleanBackups($rollbackDir, $except = null) + protected function cleanBackups($rollbackDir, $except = null): void { $finder = $this->getOldInstallationFinder($rollbackDir); $io = $this->getIO(); diff --git a/src/Composer/Command/StatusCommand.php b/src/Composer/Command/StatusCommand.php index eed32b623..99cd983d1 100644 --- a/src/Composer/Command/StatusCommand.php +++ b/src/Composer/Command/StatusCommand.php @@ -40,7 +40,7 @@ class StatusCommand extends BaseCommand * @return void * @throws \Symfony\Component\Console\Exception\InvalidArgumentException */ - protected function configure() + protected function configure(): void { $this ->setName('status') diff --git a/src/Composer/Command/SuggestsCommand.php b/src/Composer/Command/SuggestsCommand.php index 8c72ba045..eae73a05c 100644 --- a/src/Composer/Command/SuggestsCommand.php +++ b/src/Composer/Command/SuggestsCommand.php @@ -26,7 +26,7 @@ class SuggestsCommand extends BaseCommand /** * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('suggests') diff --git a/src/Composer/Command/ValidateCommand.php b/src/Composer/Command/ValidateCommand.php index 700461bcf..ee9ffa811 100644 --- a/src/Composer/Command/ValidateCommand.php +++ b/src/Composer/Command/ValidateCommand.php @@ -38,7 +38,7 @@ class ValidateCommand extends BaseCommand * configure * @return void */ - protected function configure() + protected function configure(): void { $this ->setName('validate') @@ -169,7 +169,7 @@ EOT * * @return void */ - private function outputResult(IOInterface $io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false) + private function outputResult(IOInterface $io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false): void { $doPrintSchemaUrl = false; diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 362deeb34..619ac4ea8 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -44,7 +44,7 @@ class Compiler * * @throws \RuntimeException */ - public function compile($pharFile = 'composer.phar') + public function compile($pharFile = 'composer.phar'): void { if (file_exists($pharFile)) { unlink($pharFile); @@ -217,7 +217,7 @@ class Compiler * * @return void */ - private function addFile(\Phar $phar, \SplFileInfo $file, $strip = true) + private function addFile(\Phar $phar, \SplFileInfo $file, $strip = true): void { $path = $this->getRelativeFilePath($file); $content = file_get_contents($file); @@ -245,7 +245,7 @@ class Compiler /** * @return void */ - private function addComposerBin(\Phar $phar) + private function addComposerBin(\Phar $phar): void { $content = file_get_contents(__DIR__.'/../../bin/composer'); $content = Preg::replace('{^#!/usr/bin/env php\s*}', '', $content); diff --git a/src/Composer/Composer.php b/src/Composer/Composer.php index 749c9e35d..8f8e4e74f 100644 --- a/src/Composer/Composer.php +++ b/src/Composer/Composer.php @@ -144,7 +144,7 @@ class Composer /** * @return void */ - public function setPackage(RootPackageInterface $package) + public function setPackage(RootPackageInterface $package): void { $this->package = $package; } @@ -160,7 +160,7 @@ class Composer /** * @return void */ - public function setConfig(Config $config) + public function setConfig(Config $config): void { $this->config = $config; } @@ -176,7 +176,7 @@ class Composer /** * @return void */ - public function setLocker(Locker $locker) + public function setLocker(Locker $locker): void { $this->locker = $locker; } @@ -192,7 +192,7 @@ class Composer /** * @return void */ - public function setLoop(Loop $loop) + public function setLoop(Loop $loop): void { $this->loop = $loop; } @@ -208,7 +208,7 @@ class Composer /** * @return void */ - public function setRepositoryManager(RepositoryManager $manager) + public function setRepositoryManager(RepositoryManager $manager): void { $this->repositoryManager = $manager; } @@ -224,7 +224,7 @@ class Composer /** * @return void */ - public function setDownloadManager(DownloadManager $manager) + public function setDownloadManager(DownloadManager $manager): void { $this->downloadManager = $manager; } @@ -240,7 +240,7 @@ class Composer /** * @return void */ - public function setArchiveManager(ArchiveManager $manager) + public function setArchiveManager(ArchiveManager $manager): void { $this->archiveManager = $manager; } @@ -256,7 +256,7 @@ class Composer /** * @return void */ - public function setInstallationManager(InstallationManager $manager) + public function setInstallationManager(InstallationManager $manager): void { $this->installationManager = $manager; } @@ -272,7 +272,7 @@ class Composer /** * @return void */ - public function setPluginManager(PluginManager $manager) + public function setPluginManager(PluginManager $manager): void { $this->pluginManager = $manager; } @@ -288,7 +288,7 @@ class Composer /** * @return void */ - public function setEventDispatcher(EventDispatcher $eventDispatcher) + public function setEventDispatcher(EventDispatcher $eventDispatcher): void { $this->eventDispatcher = $eventDispatcher; } @@ -304,7 +304,7 @@ class Composer /** * @return void */ - public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator) + public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void { $this->autoloadGenerator = $autoloadGenerator; } diff --git a/src/Composer/Config.php b/src/Composer/Config.php index a83f70175..1dd2f0773 100644 --- a/src/Composer/Config.php +++ b/src/Composer/Config.php @@ -140,7 +140,7 @@ class Config /** * @return void */ - public function setConfigSource(ConfigSourceInterface $source) + public function setConfigSource(ConfigSourceInterface $source): void { $this->configSource = $source; } @@ -156,7 +156,7 @@ class Config /** * @return void */ - public function setAuthConfigSource(ConfigSourceInterface $source) + public function setAuthConfigSource(ConfigSourceInterface $source): void { $this->authConfigSource = $source; } @@ -177,7 +177,7 @@ class Config * * @return void */ - public function merge($config, $source = self::SOURCE_UNKNOWN) + public function merge($config, $source = self::SOURCE_UNKNOWN): void { // override defaults with given config if (!empty($config['config']) && is_array($config['config'])) { @@ -471,7 +471,7 @@ class Config * * @return void */ - private function setSourceOfConfigValue($configValue, $path, $source) + private function setSourceOfConfigValue($configValue, $path, $source): void { $this->sourceOfConfigValue[$path] = $source; @@ -563,7 +563,7 @@ class Config * * @return void */ - private function disableRepoByName($name) + private function disableRepoByName($name): void { if (isset($this->repositories[$name])) { unset($this->repositories[$name]); @@ -580,7 +580,7 @@ class Config * * @return void */ - public function prohibitUrlByConfig($url, IOInterface $io = null) + public function prohibitUrlByConfig($url, IOInterface $io = null): void { // Return right away if the URL is malformed or custom (see issue #5173) if (false === filter_var($url, FILTER_VALIDATE_URL)) { @@ -626,7 +626,7 @@ class Config * * @return void */ - public static function disableProcessTimeout() + public static function disableProcessTimeout(): void { // Override global timeout set earlier by environment or config ProcessExecutor::setTimeout(0); diff --git a/src/Composer/Console/GithubActionError.php b/src/Composer/Console/GithubActionError.php index 6cd49c20d..6f8710261 100644 --- a/src/Composer/Console/GithubActionError.php +++ b/src/Composer/Console/GithubActionError.php @@ -34,7 +34,7 @@ final class GithubActionError * * @return void */ - public function emit($message, $file = null, $line = null) + public function emit($message, $file = null, $line = null): void { if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) { $message = $this->escapeData($message); diff --git a/src/Composer/DependencyResolver/Decisions.php b/src/Composer/DependencyResolver/Decisions.php index 2df464bc1..686ce8fcb 100644 --- a/src/Composer/DependencyResolver/Decisions.php +++ b/src/Composer/DependencyResolver/Decisions.php @@ -43,7 +43,7 @@ class Decisions implements \Iterator, \Countable * @param int $level * @return void */ - public function decide($literal, $level, Rule $why) + public function decide($literal, $level, Rule $why): void { $this->addDecision($literal, $level); $this->decisionQueue[] = array( @@ -177,7 +177,7 @@ class Decisions implements \Iterator, \Countable /** * @return void */ - public function reset() + public function reset(): void { while ($decision = array_pop($this->decisionQueue)) { $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0; @@ -188,7 +188,7 @@ class Decisions implements \Iterator, \Countable * @param int $offset * @return void */ - public function resetToOffset($offset) + public function resetToOffset($offset): void { while (\count($this->decisionQueue) > $offset + 1) { $decision = array_pop($this->decisionQueue); @@ -199,7 +199,7 @@ class Decisions implements \Iterator, \Countable /** * @return void */ - public function revertLast() + public function revertLast(): void { $this->decisionMap[abs($this->lastLiteral())] = 0; array_pop($this->decisionQueue); @@ -252,7 +252,7 @@ class Decisions implements \Iterator, \Countable * @param int $level * @return void */ - protected function addDecision($literal, $level) + protected function addDecision($literal, $level): void { $packageId = abs($literal); diff --git a/src/Composer/DependencyResolver/LockTransaction.php b/src/Composer/DependencyResolver/LockTransaction.php index a3abe1e2a..e46b66c1a 100644 --- a/src/Composer/DependencyResolver/LockTransaction.php +++ b/src/Composer/DependencyResolver/LockTransaction.php @@ -62,7 +62,7 @@ class LockTransaction extends Transaction /** * @return void */ - public function setResultPackages(Pool $pool, Decisions $decisions) + public function setResultPackages(Pool $pool, Decisions $decisions): void { $this->resultPackages = array('all' => array(), 'non-dev' => array(), 'dev' => array()); foreach ($decisions as $i => $decision) { @@ -82,7 +82,7 @@ class LockTransaction extends Transaction /** * @return void */ - public function setNonDevPackages(LockTransaction $extractionResult) + public function setNonDevPackages(LockTransaction $extractionResult): void { $packages = $extractionResult->getNewLockPackages(false); diff --git a/src/Composer/DependencyResolver/MultiConflictRule.php b/src/Composer/DependencyResolver/MultiConflictRule.php index deda73010..35f92be9b 100644 --- a/src/Composer/DependencyResolver/MultiConflictRule.php +++ b/src/Composer/DependencyResolver/MultiConflictRule.php @@ -86,7 +86,7 @@ class MultiConflictRule extends Rule * @return never * @throws \RuntimeException */ - public function disable() + public function disable(): void { throw new \RuntimeException("Disabling multi conflict rules is not possible. Please contact composer at https://github.com/composer/composer to let us debug what lead to this situation."); } diff --git a/src/Composer/DependencyResolver/Pool.php b/src/Composer/DependencyResolver/Pool.php index 0fa5783e4..3888ef8a5 100644 --- a/src/Composer/DependencyResolver/Pool.php +++ b/src/Composer/DependencyResolver/Pool.php @@ -93,7 +93,7 @@ class Pool implements \Countable * @param BasePackage[] $packages * @return void */ - private function setPackages(array $packages) + private function setPackages(array $packages): void { $id = 1; diff --git a/src/Composer/DependencyResolver/PoolBuilder.php b/src/Composer/DependencyResolver/PoolBuilder.php index 8ca7050fd..c0b2ed4d2 100644 --- a/src/Composer/DependencyResolver/PoolBuilder.php +++ b/src/Composer/DependencyResolver/PoolBuilder.php @@ -298,7 +298,7 @@ class PoolBuilder * @param string $name * @return void */ - private function markPackageNameForLoading(Request $request, $name, ConstraintInterface $constraint) + private function markPackageNameForLoading(Request $request, $name, ConstraintInterface $constraint): void { // Skip platform requires at this stage if (PlatformRepository::isPlatformPackage($name)) { @@ -357,7 +357,7 @@ class PoolBuilder * @param RepositoryInterface[] $repositories * @return void */ - private function loadPackagesMarkedForLoading(Request $request, array $repositories) + private function loadPackagesMarkedForLoading(Request $request, array $repositories): void { foreach ($this->packagesToLoad as $name => $constraint) { $this->loadedPackages[$name] = $constraint; @@ -394,7 +394,7 @@ class PoolBuilder * @param RepositoryInterface[] $repositories * @return void */ - private function loadPackage(Request $request, array $repositories, BasePackage $package, $propagateUpdate) + private function loadPackage(Request $request, array $repositories, BasePackage $package, $propagateUpdate): void { $index = $this->indexCounter++; $this->packages[$index] = $package; @@ -568,7 +568,7 @@ class PoolBuilder /** * @return void */ - private function warnAboutNonMatchingUpdateAllowList(Request $request) + private function warnAboutNonMatchingUpdateAllowList(Request $request): void { foreach ($this->updateAllowList as $pattern => $void) { $patternRegexp = BasePackage::packageNameToRegexp($pattern); @@ -600,7 +600,7 @@ class PoolBuilder * @param string $name * @return void */ - private function unlockPackage(Request $request, array $repositories, $name) + private function unlockPackage(Request $request, array $repositories, $name): void { foreach ($this->skippedLoad[$name] as $packageOrReplacer) { // if we unfixed a replaced package name, we also need to unfix the replacer itself @@ -666,7 +666,7 @@ class PoolBuilder * @param int $index * @return void */ - private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index) + private function removeLoadedPackage(Request $request, array $repositories, BasePackage $package, $index): void { $repoIndex = array_search($package->getRepository(), $repositories, true); diff --git a/src/Composer/DependencyResolver/PoolOptimizer.php b/src/Composer/DependencyResolver/PoolOptimizer.php index 7e1e32fdc..420c1ec66 100644 --- a/src/Composer/DependencyResolver/PoolOptimizer.php +++ b/src/Composer/DependencyResolver/PoolOptimizer.php @@ -99,7 +99,7 @@ class PoolOptimizer /** * @return void */ - private function prepare(Request $request, Pool $pool) + private function prepare(Request $request, Pool $pool): void { $irremovablePackageConstraintGroups = array(); @@ -155,7 +155,7 @@ class PoolOptimizer /** * @return void */ - private function markPackageIrremovable(BasePackage $package) + private function markPackageIrremovable(BasePackage $package): void { $this->irremovablePackages[$package->id] = true; if ($package instanceof AliasPackage) { @@ -193,7 +193,7 @@ class PoolOptimizer /** * @return void */ - private function optimizeByIdenticalDependencies(Request $request, Pool $pool) + private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void { $identicalDefinitionsPerPackage = array(); $packageIdenticalDefinitionLookup = array(); @@ -322,7 +322,7 @@ class PoolOptimizer * @param int $id * @return void */ - private function markPackageForRemoval($id) + private function markPackageForRemoval($id): void { // We are not allowed to remove packages if they have been marked as irremovable if (isset($this->irremovablePackages[$id])) { @@ -337,7 +337,7 @@ class PoolOptimizer * @param array> $packageIdenticalDefinitionLookup * @return void */ - private function keepPackage(BasePackage $package, $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup) + private function keepPackage(BasePackage $package, $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup): void { unset($this->packagesToRemove[$package->id]); @@ -389,7 +389,7 @@ class PoolOptimizer * * @return void */ - private function optimizeImpossiblePackagesAway(Request $request, Pool $pool) + private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void { if (count($request->getLockedPackages()) === 0) { return; diff --git a/src/Composer/DependencyResolver/Request.php b/src/Composer/DependencyResolver/Request.php index 3b680ad0b..7499b1f99 100644 --- a/src/Composer/DependencyResolver/Request.php +++ b/src/Composer/DependencyResolver/Request.php @@ -64,7 +64,7 @@ class Request * @param string $packageName * @return void */ - public function requireName($packageName, ConstraintInterface $constraint = null) + public function requireName($packageName, ConstraintInterface $constraint = null): void { $packageName = strtolower($packageName); @@ -85,7 +85,7 @@ class Request * * @return void */ - public function fixPackage(BasePackage $package) + public function fixPackage(BasePackage $package): void { $this->fixedPackages[spl_object_hash($package)] = $package; } @@ -102,7 +102,7 @@ class Request * * @return void */ - public function lockPackage(BasePackage $package) + public function lockPackage(BasePackage $package): void { $this->lockedPackages[spl_object_hash($package)] = $package; } @@ -116,7 +116,7 @@ class Request * * @return void */ - public function fixLockedPackage(BasePackage $package) + public function fixLockedPackage(BasePackage $package): void { $this->fixedPackages[spl_object_hash($package)] = $package; $this->fixedLockedPackages[spl_object_hash($package)] = $package; @@ -125,7 +125,7 @@ class Request /** * @return void */ - public function unlockPackage(BasePackage $package) + public function unlockPackage(BasePackage $package): void { unset($this->lockedPackages[spl_object_hash($package)]); } @@ -135,7 +135,7 @@ class Request * @param false|self::UPDATE_* $updateAllowTransitiveDependencies * @return void */ - public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies) + public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies): void { $this->updateAllowList = $updateAllowList; $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies; diff --git a/src/Composer/DependencyResolver/Rule.php b/src/Composer/DependencyResolver/Rule.php index 133e7f7a0..c5f324038 100644 --- a/src/Composer/DependencyResolver/Rule.php +++ b/src/Composer/DependencyResolver/Rule.php @@ -128,7 +128,7 @@ abstract class Rule * @param RuleSet::TYPE_* $type * @return void */ - public function setType($type) + public function setType($type): void { $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE); } @@ -144,7 +144,7 @@ abstract class Rule /** * @return void */ - public function disable() + public function disable(): void { $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED); } @@ -152,7 +152,7 @@ abstract class Rule /** * @return void */ - public function enable() + public function enable(): void { $this->bitfield &= ~(255 << self::BITFIELD_DISABLED); } diff --git a/src/Composer/DependencyResolver/RuleSet.php b/src/Composer/DependencyResolver/RuleSet.php index d83320c52..65369c1b1 100644 --- a/src/Composer/DependencyResolver/RuleSet.php +++ b/src/Composer/DependencyResolver/RuleSet.php @@ -59,7 +59,7 @@ class RuleSet implements \IteratorAggregate, \Countable * @param self::TYPE_* $type * @return void */ - public function add(Rule $rule, $type) + public function add(Rule $rule, $type): void { if (!isset(self::$types[$type])) { throw new \OutOfBoundsException('Unknown rule type: ' . $type); diff --git a/src/Composer/DependencyResolver/RuleSetGenerator.php b/src/Composer/DependencyResolver/RuleSetGenerator.php index fef50b0eb..3dee4d5dc 100644 --- a/src/Composer/DependencyResolver/RuleSetGenerator.php +++ b/src/Composer/DependencyResolver/RuleSetGenerator.php @@ -152,7 +152,7 @@ class RuleSetGenerator * * @return void */ - private function addRule($type, Rule $newRule = null) + private function addRule($type, Rule $newRule = null): void { if (!$newRule) { return; @@ -164,7 +164,7 @@ class RuleSetGenerator /** * @return void */ - protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter) + protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void { /** @var \SplQueue */ $workQueue = new \SplQueue; @@ -218,7 +218,7 @@ class RuleSetGenerator /** * @return void */ - protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter) + protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void { /** @var BasePackage $package */ foreach ($this->addedMap as $package) { @@ -259,7 +259,7 @@ class RuleSetGenerator /** * @return void */ - protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter) + protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void { foreach ($request->getFixedPackages() as $package) { if ($package->id == -1) { @@ -305,7 +305,7 @@ class RuleSetGenerator /** * @return void */ - protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter) + protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void { foreach ($this->pool->getPackages() as $package) { // ensure that rules for root alias packages and aliases of packages which were loaded are also loaded diff --git a/src/Composer/DependencyResolver/RuleWatchChain.php b/src/Composer/DependencyResolver/RuleWatchChain.php index a03aaf2f6..a54032686 100644 --- a/src/Composer/DependencyResolver/RuleWatchChain.php +++ b/src/Composer/DependencyResolver/RuleWatchChain.php @@ -29,7 +29,7 @@ class RuleWatchChain extends \SplDoublyLinkedList * @param int $offset The offset to seek to. * @return void */ - public function seek($offset) + public function seek($offset): void { $this->rewind(); for ($i = 0; $i < $offset; $i++, $this->next()); @@ -45,7 +45,7 @@ class RuleWatchChain extends \SplDoublyLinkedList * * @return void */ - public function remove() + public function remove(): void { $offset = $this->key(); $this->offsetUnset($offset); diff --git a/src/Composer/DependencyResolver/RuleWatchGraph.php b/src/Composer/DependencyResolver/RuleWatchGraph.php index e9e3caa17..16b8c5235 100644 --- a/src/Composer/DependencyResolver/RuleWatchGraph.php +++ b/src/Composer/DependencyResolver/RuleWatchGraph.php @@ -40,7 +40,7 @@ class RuleWatchGraph * @param RuleWatchNode $node The rule node to be inserted into the graph * @return void */ - public function insert(RuleWatchNode $node) + public function insert(RuleWatchNode $node): void { if ($node->getRule()->isAssertion()) { return; @@ -156,7 +156,7 @@ class RuleWatchGraph * @param RuleWatchNode $node The rule node to be moved * @return void */ - protected function moveWatch($fromLiteral, $toLiteral, RuleWatchNode $node) + protected function moveWatch($fromLiteral, $toLiteral, RuleWatchNode $node): void { if (!isset($this->watchChains[$toLiteral])) { $this->watchChains[$toLiteral] = new RuleWatchChain; diff --git a/src/Composer/DependencyResolver/RuleWatchNode.php b/src/Composer/DependencyResolver/RuleWatchNode.php index a0abf254d..aef4dd135 100644 --- a/src/Composer/DependencyResolver/RuleWatchNode.php +++ b/src/Composer/DependencyResolver/RuleWatchNode.php @@ -54,7 +54,7 @@ class RuleWatchNode * @param Decisions $decisions The decisions made so far by the solver * @return void */ - public function watch2OnHighest(Decisions $decisions) + public function watch2OnHighest(Decisions $decisions): void { $literals = $this->rule->getLiterals(); @@ -107,7 +107,7 @@ class RuleWatchNode * @param int $to The literal to be watched now * @return void */ - public function moveWatch($from, $to) + public function moveWatch($from, $to): void { if ($this->watch1 == $from) { $this->watch1 = $to; diff --git a/src/Composer/DependencyResolver/Solver.php b/src/Composer/DependencyResolver/Solver.php index b0a3eb00f..45814c36e 100644 --- a/src/Composer/DependencyResolver/Solver.php +++ b/src/Composer/DependencyResolver/Solver.php @@ -86,7 +86,7 @@ class Solver /** * @return void */ - private function makeAssertionRuleDecisions() + private function makeAssertionRuleDecisions(): void { $decisionStart = \count($this->decisions) - 1; @@ -159,7 +159,7 @@ class Solver /** * @return void */ - protected function setupFixedMap(Request $request) + protected function setupFixedMap(Request $request): void { $this->fixedMap = array(); foreach ($request->getFixedPackages() as $package) { @@ -170,7 +170,7 @@ class Solver /** * @return void */ - protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter) + protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void { foreach ($request->getRequires() as $packageName => $constraint) { if ($platformRequirementFilter->isIgnored($packageName)) { @@ -261,7 +261,7 @@ class Solver * * @return void */ - private function revert($level) + private function revert($level): void { while (!$this->decisions->isEmpty()) { $literal = $this->decisions->lastLiteral(); @@ -518,7 +518,7 @@ class Solver * @param array $ruleSeen * @return void */ - private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen) + private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule, array &$ruleSeen): void { $why = spl_object_hash($conflictRule); $ruleSeen[$why] = true; @@ -606,7 +606,7 @@ class Solver * * @return void */ - private function enableDisableLearnedRules() + private function enableDisableLearnedRules(): void { foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) { $why = $this->learnedWhy[spl_object_hash($rule)]; @@ -631,7 +631,7 @@ class Solver /** * @return void */ - private function runSat() + private function runSat(): void { $this->propagateIndex = 0; diff --git a/src/Composer/DependencyResolver/Transaction.php b/src/Composer/DependencyResolver/Transaction.php index ef9c74174..265474123 100644 --- a/src/Composer/DependencyResolver/Transaction.php +++ b/src/Composer/DependencyResolver/Transaction.php @@ -69,7 +69,7 @@ class Transaction * @param PackageInterface[] $resultPackages * @return void */ - private function setResultPackageMaps($resultPackages) + private function setResultPackageMaps($resultPackages): void { $packageSort = function (PackageInterface $a, PackageInterface $b) { // sort alias packages by the same name behind their non alias version diff --git a/src/Composer/Downloader/GzipDownloader.php b/src/Composer/Downloader/GzipDownloader.php index 8b5caf474..11b607e79 100644 --- a/src/Composer/Downloader/GzipDownloader.php +++ b/src/Composer/Downloader/GzipDownloader.php @@ -59,7 +59,7 @@ class GzipDownloader extends ArchiveDownloader * * @return void */ - private function extractUsingExt($file, $targetFilepath) + private function extractUsingExt($file, $targetFilepath): void { $archiveFile = gzopen($file, 'rb'); $targetFile = fopen($targetFilepath, 'wb'); diff --git a/src/Composer/Downloader/PerforceDownloader.php b/src/Composer/Downloader/PerforceDownloader.php index c7d0e7985..8f2427727 100644 --- a/src/Composer/Downloader/PerforceDownloader.php +++ b/src/Composer/Downloader/PerforceDownloader.php @@ -73,7 +73,7 @@ class PerforceDownloader extends VcsDownloader * * @return void */ - public function initPerforce(PackageInterface $package, $path, $url) + public function initPerforce(PackageInterface $package, $path, $url): void { if (!empty($this->perforce)) { $this->perforce->initializePath($path); @@ -126,7 +126,7 @@ class PerforceDownloader extends VcsDownloader /** * @return void */ - public function setPerforce(Perforce $perforce) + public function setPerforce(Perforce $perforce): void { $this->perforce = $perforce; } diff --git a/src/Composer/Downloader/TransportException.php b/src/Composer/Downloader/TransportException.php index 92be261a6..2f5a28361 100644 --- a/src/Composer/Downloader/TransportException.php +++ b/src/Composer/Downloader/TransportException.php @@ -31,7 +31,7 @@ class TransportException extends \RuntimeException * * @return void */ - public function setHeaders($headers) + public function setHeaders($headers): void { $this->headers = $headers; } @@ -49,7 +49,7 @@ class TransportException extends \RuntimeException * * @return void */ - public function setResponse($response) + public function setResponse($response): void { $this->response = $response; } @@ -67,7 +67,7 @@ class TransportException extends \RuntimeException * * @return void */ - public function setStatusCode($statusCode) + public function setStatusCode($statusCode): void { $this->statusCode = $statusCode; } @@ -93,7 +93,7 @@ class TransportException extends \RuntimeException * * @return void */ - public function setResponseInfo(array $responseInfo) + public function setResponseInfo(array $responseInfo): void { $this->responseInfo = $responseInfo; } diff --git a/src/Composer/IO/BufferIO.php b/src/Composer/IO/BufferIO.php index 627abec9d..bc01787b1 100644 --- a/src/Composer/IO/BufferIO.php +++ b/src/Composer/IO/BufferIO.php @@ -77,7 +77,7 @@ class BufferIO extends ConsoleIO * * @return void */ - public function setUserInputs(array $inputs) + public function setUserInputs(array $inputs): void { if (!$this->input instanceof StreamableInputInterface) { throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.'); diff --git a/src/Composer/IO/NullIO.php b/src/Composer/IO/NullIO.php index 89c574e43..cd8e5fc12 100644 --- a/src/Composer/IO/NullIO.php +++ b/src/Composer/IO/NullIO.php @@ -62,28 +62,28 @@ class NullIO extends BaseIO /** * @inheritDoc */ - public function write($messages, $newline = true, $verbosity = self::NORMAL) + public function write($messages, $newline = true, $verbosity = self::NORMAL): void { } /** * @inheritDoc */ - public function writeError($messages, $newline = true, $verbosity = self::NORMAL) + public function writeError($messages, $newline = true, $verbosity = self::NORMAL): void { } /** * @inheritDoc */ - public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL) + public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL): void { } /** * @inheritDoc */ - public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL) + public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL): void { } diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index 8bd88e5b9..43af3fde5 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -919,7 +919,7 @@ class Installer * * @return void */ - private function requirePackagesForUpdate(Request $request, LockArrayRepository $lockedRepository = null, $includeDevRequires = true) + private function requirePackagesForUpdate(Request $request, LockArrayRepository $lockedRepository = null, $includeDevRequires = true): void { // if we're updating mirrors we want to keep exactly the same versions installed which are in the lock file, but we want current remote metadata if ($this->updateMirrors) { @@ -988,7 +988,7 @@ class Installer * * @return void */ - private function mockLocalRepositories(RepositoryManager $rm) + private function mockLocalRepositories(RepositoryManager $rm): void { $packages = array(); foreach ($rm->getLocalRepository()->getPackages() as $package) { diff --git a/src/Composer/Installer/BinaryInstaller.php b/src/Composer/Installer/BinaryInstaller.php index 417e9be2b..d1902d8a2 100644 --- a/src/Composer/Installer/BinaryInstaller.php +++ b/src/Composer/Installer/BinaryInstaller.php @@ -62,7 +62,7 @@ class BinaryInstaller * * @return void */ - public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true) + public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true): void { $binaries = $this->getBinaries($package); if (!$binaries) { @@ -120,7 +120,7 @@ class BinaryInstaller /** * @return void */ - public function removeBinaries(PackageInterface $package) + public function removeBinaries(PackageInterface $package): void { $this->initializeBinDir(); @@ -180,7 +180,7 @@ class BinaryInstaller * * @return void */ - protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package) + protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package): void { // add unixy support for cygwin and similar environments if ('.bat' !== substr($binPath, -4)) { @@ -202,7 +202,7 @@ class BinaryInstaller * * @return void */ - protected function installUnixyProxyBinaries($binPath, $link) + protected function installUnixyProxyBinaries($binPath, $link): void { file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link)); Silencer::call('chmod', $link, 0777 & ~umask()); @@ -211,7 +211,7 @@ class BinaryInstaller /** * @return void */ - protected function initializeBinDir() + protected function initializeBinDir(): void { $this->filesystem->ensureDirectoryExists($this->binDir); $this->binDir = realpath($this->binDir); diff --git a/src/Composer/Installer/SuggestedPackagesReporter.php b/src/Composer/Installer/SuggestedPackagesReporter.php index f8fb9d887..840e63f51 100644 --- a/src/Composer/Installer/SuggestedPackagesReporter.php +++ b/src/Composer/Installer/SuggestedPackagesReporter.php @@ -104,7 +104,7 @@ class SuggestedPackagesReporter * @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown * @return void */ - public function output($mode, InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null) + public function output($mode, InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): void { $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf); @@ -170,7 +170,7 @@ class SuggestedPackagesReporter * @param PackageInterface|null $onlyDependentsOf If passed in, only the suggestions from direct dependents of that package, or from the package itself, will be shown * @return void */ - public function outputMinimalistic(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null) + public function outputMinimalistic(InstalledRepository $installedRepo = null, PackageInterface $onlyDependentsOf = null): void { $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf); if ($suggestedPackages) { diff --git a/src/Composer/Package/AliasPackage.php b/src/Composer/Package/AliasPackage.php index 4dd2bd9aa..8b47879c4 100644 --- a/src/Composer/Package/AliasPackage.php +++ b/src/Composer/Package/AliasPackage.php @@ -249,7 +249,7 @@ class AliasPackage extends BasePackage return $this->aliasOf->getExtra(); } - public function setInstallationSource($type) + public function setInstallationSource($type): void { $this->aliasOf->setInstallationSource($type); } @@ -279,12 +279,12 @@ class AliasPackage extends BasePackage return $this->aliasOf->getSourceReference(); } - public function setSourceReference($reference) + public function setSourceReference($reference): void { $this->aliasOf->setSourceReference($reference); } - public function setSourceMirrors($mirrors) + public function setSourceMirrors($mirrors): void { $this->aliasOf->setSourceMirrors($mirrors); } @@ -314,7 +314,7 @@ class AliasPackage extends BasePackage return $this->aliasOf->getDistReference(); } - public function setDistReference($reference) + public function setDistReference($reference): void { $this->aliasOf->setDistReference($reference); } @@ -324,7 +324,7 @@ class AliasPackage extends BasePackage return $this->aliasOf->getDistSha1Checksum(); } - public function setTransportOptions(array $options) + public function setTransportOptions(array $options): void { $this->aliasOf->setTransportOptions($options); } @@ -334,7 +334,7 @@ class AliasPackage extends BasePackage return $this->aliasOf->getTransportOptions(); } - public function setDistMirrors($mirrors) + public function setDistMirrors($mirrors): void { $this->aliasOf->setDistMirrors($mirrors); } @@ -384,17 +384,17 @@ class AliasPackage extends BasePackage return $this->aliasOf->isDefaultBranch(); } - public function setDistUrl($url) + public function setDistUrl($url): void { $this->aliasOf->setDistUrl($url); } - public function setDistType($type) + public function setDistType($type): void { $this->aliasOf->setDistType($type); } - public function setSourceDistReferences($reference) + public function setSourceDistReferences($reference): void { $this->aliasOf->setSourceDistReferences($reference); } diff --git a/src/Composer/Package/Archiver/ArchivableFilesFilter.php b/src/Composer/Package/Archiver/ArchivableFilesFilter.php index 3242df7e8..9a5be1a19 100644 --- a/src/Composer/Package/Archiver/ArchivableFilesFilter.php +++ b/src/Composer/Package/Archiver/ArchivableFilesFilter.php @@ -40,7 +40,7 @@ class ArchivableFilesFilter extends FilterIterator * * @return void */ - public function addEmptyDir(PharData $phar, $sources) + public function addEmptyDir(PharData $phar, $sources): void { foreach ($this->dirs as $filepath) { $localname = str_replace($sources . "/", '', $filepath); diff --git a/src/Composer/Package/Archiver/ArchiveManager.php b/src/Composer/Package/Archiver/ArchiveManager.php index a6682fb3b..197c7fe8e 100644 --- a/src/Composer/Package/Archiver/ArchiveManager.php +++ b/src/Composer/Package/Archiver/ArchiveManager.php @@ -56,7 +56,7 @@ class ArchiveManager * * @return void */ - public function addArchiver(ArchiverInterface $archiver) + public function addArchiver(ArchiverInterface $archiver): void { $this->archivers[] = $archiver; } diff --git a/src/Composer/Package/Comparer/Comparer.php b/src/Composer/Package/Comparer/Comparer.php index b24661ad3..d7c2a5fc7 100644 --- a/src/Composer/Package/Comparer/Comparer.php +++ b/src/Composer/Package/Comparer/Comparer.php @@ -31,7 +31,7 @@ class Comparer * * @return void */ - public function setSource($source) + public function setSource($source): void { $this->source = $source; } @@ -41,7 +41,7 @@ class Comparer * * @return void */ - public function setUpdate($update) + public function setUpdate($update): void { $this->update = $update; } @@ -82,7 +82,7 @@ class Comparer /** * @return void */ - public function doCompare() + public function doCompare(): void { $source = array(); $destination = array(); diff --git a/src/Composer/Package/CompleteAliasPackage.php b/src/Composer/Package/CompleteAliasPackage.php index 5c9e340f3..ee8f92d91 100644 --- a/src/Composer/Package/CompleteAliasPackage.php +++ b/src/Composer/Package/CompleteAliasPackage.php @@ -45,7 +45,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getScripts(); } - public function setScripts(array $scripts) + public function setScripts(array $scripts): void { $this->aliasOf->setScripts($scripts); } @@ -55,7 +55,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getRepositories(); } - public function setRepositories(array $repositories) + public function setRepositories(array $repositories): void { $this->aliasOf->setRepositories($repositories); } @@ -65,7 +65,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getLicense(); } - public function setLicense(array $license) + public function setLicense(array $license): void { $this->aliasOf->setLicense($license); } @@ -75,7 +75,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getKeywords(); } - public function setKeywords(array $keywords) + public function setKeywords(array $keywords): void { $this->aliasOf->setKeywords($keywords); } @@ -85,7 +85,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getDescription(); } - public function setDescription($description) + public function setDescription($description): void { $this->aliasOf->setDescription($description); } @@ -95,7 +95,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getHomepage(); } - public function setHomepage($homepage) + public function setHomepage($homepage): void { $this->aliasOf->setHomepage($homepage); } @@ -105,7 +105,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getAuthors(); } - public function setAuthors(array $authors) + public function setAuthors(array $authors): void { $this->aliasOf->setAuthors($authors); } @@ -115,7 +115,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getSupport(); } - public function setSupport(array $support) + public function setSupport(array $support): void { $this->aliasOf->setSupport($support); } @@ -125,7 +125,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getFunding(); } - public function setFunding(array $funding) + public function setFunding(array $funding): void { $this->aliasOf->setFunding($funding); } @@ -140,7 +140,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getReplacementPackage(); } - public function setAbandoned($abandoned) + public function setAbandoned($abandoned): void { $this->aliasOf->setAbandoned($abandoned); } @@ -150,7 +150,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getArchiveName(); } - public function setArchiveName($name) + public function setArchiveName($name): void { $this->aliasOf->setArchiveName($name); } @@ -160,7 +160,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf return $this->aliasOf->getArchiveExcludes(); } - public function setArchiveExcludes(array $excludes) + public function setArchiveExcludes(array $excludes): void { $this->aliasOf->setArchiveExcludes($excludes); } diff --git a/src/Composer/Package/RootAliasPackage.php b/src/Composer/Package/RootAliasPackage.php index 4817653dc..2ae19890d 100644 --- a/src/Composer/Package/RootAliasPackage.php +++ b/src/Composer/Package/RootAliasPackage.php @@ -91,7 +91,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setRequires(array $require) + public function setRequires(array $require): void { $this->requires = $this->replaceSelfVersionDependencies($require, Link::TYPE_REQUIRE); @@ -101,7 +101,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setDevRequires(array $devRequire) + public function setDevRequires(array $devRequire): void { $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, Link::TYPE_DEV_REQUIRE); @@ -111,7 +111,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setConflicts(array $conflicts) + public function setConflicts(array $conflicts): void { $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT); $this->aliasOf->setConflicts($conflicts); @@ -120,7 +120,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setProvides(array $provides) + public function setProvides(array $provides): void { $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE); $this->aliasOf->setProvides($provides); @@ -129,7 +129,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setReplaces(array $replaces) + public function setReplaces(array $replaces): void { $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE); $this->aliasOf->setReplaces($replaces); @@ -138,7 +138,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setAutoload(array $autoload) + public function setAutoload(array $autoload): void { $this->aliasOf->setAutoload($autoload); } @@ -146,7 +146,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setDevAutoload(array $devAutoload) + public function setDevAutoload(array $devAutoload): void { $this->aliasOf->setDevAutoload($devAutoload); } @@ -154,7 +154,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setStabilityFlags(array $stabilityFlags) + public function setStabilityFlags(array $stabilityFlags): void { $this->aliasOf->setStabilityFlags($stabilityFlags); } @@ -162,7 +162,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setMinimumStability($minimumStability) + public function setMinimumStability($minimumStability): void { $this->aliasOf->setMinimumStability($minimumStability); } @@ -170,7 +170,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setPreferStable($preferStable) + public function setPreferStable($preferStable): void { $this->aliasOf->setPreferStable($preferStable); } @@ -178,7 +178,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setConfig(array $config) + public function setConfig(array $config): void { $this->aliasOf->setConfig($config); } @@ -186,7 +186,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setReferences(array $references) + public function setReferences(array $references): void { $this->aliasOf->setReferences($references); } @@ -194,7 +194,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setAliases(array $aliases) + public function setAliases(array $aliases): void { $this->aliasOf->setAliases($aliases); } @@ -202,7 +202,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setSuggests(array $suggests) + public function setSuggests(array $suggests): void { $this->aliasOf->setSuggests($suggests); } @@ -210,7 +210,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf /** * @inheritDoc */ - public function setExtra(array $extra) + public function setExtra(array $extra): void { $this->aliasOf->setExtra($extra); } diff --git a/src/Composer/Package/RootPackage.php b/src/Composer/Package/RootPackage.php index 070e7b6c9..3f23bb8ca 100644 --- a/src/Composer/Package/RootPackage.php +++ b/src/Composer/Package/RootPackage.php @@ -37,7 +37,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * {@inerhitDoc} */ - public function setMinimumStability($minimumStability) + public function setMinimumStability($minimumStability): void { $this->minimumStability = $minimumStability; } @@ -53,7 +53,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * @inheritDoc */ - public function setStabilityFlags(array $stabilityFlags) + public function setStabilityFlags(array $stabilityFlags): void { $this->stabilityFlags = $stabilityFlags; } @@ -69,7 +69,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * {@inerhitDoc} */ - public function setPreferStable($preferStable) + public function setPreferStable($preferStable): void { $this->preferStable = $preferStable; } @@ -85,7 +85,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * {@inerhitDoc} */ - public function setConfig(array $config) + public function setConfig(array $config): void { $this->config = $config; } @@ -101,7 +101,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * {@inerhitDoc} */ - public function setReferences(array $references) + public function setReferences(array $references): void { $this->references = $references; } @@ -117,7 +117,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface /** * {@inerhitDoc} */ - public function setAliases(array $aliases) + public function setAliases(array $aliases): void { $this->aliases = $aliases; } diff --git a/src/Composer/Platform/HhvmDetector.php b/src/Composer/Platform/HhvmDetector.php index 7fee999a6..181f15de2 100644 --- a/src/Composer/Platform/HhvmDetector.php +++ b/src/Composer/Platform/HhvmDetector.php @@ -34,7 +34,7 @@ class HhvmDetector /** * @return void */ - public function reset() + public function reset(): void { self::$hhvmVersion = null; } diff --git a/src/Composer/Plugin/PluginManager.php b/src/Composer/Plugin/PluginManager.php index 4f974d9f8..5f3390ef7 100644 --- a/src/Composer/Plugin/PluginManager.php +++ b/src/Composer/Plugin/PluginManager.php @@ -92,7 +92,7 @@ class PluginManager * * @return void */ - public function loadInstalledPlugins() + public function loadInstalledPlugins(): void { if ($this->disablePlugins) { return; @@ -111,7 +111,7 @@ class PluginManager * * @return void */ - public function deactivateInstalledPlugins() + public function deactivateInstalledPlugins(): void { if ($this->disablePlugins) { return; @@ -159,7 +159,7 @@ class PluginManager * * @throws \UnexpectedValueException */ - public function registerPackage(PackageInterface $package, $failOnMissingClasses = false, $isGlobalPlugin = false) + public function registerPackage(PackageInterface $package, $failOnMissingClasses = false, $isGlobalPlugin = false): void { if ($this->disablePlugins) { return; @@ -318,7 +318,7 @@ class PluginManager * * @throws \UnexpectedValueException */ - public function deactivatePackage(PackageInterface $package) + public function deactivatePackage(PackageInterface $package): void { if ($this->disablePlugins) { return; @@ -349,7 +349,7 @@ class PluginManager * * @throws \UnexpectedValueException */ - public function uninstallPackage(PackageInterface $package) + public function uninstallPackage(PackageInterface $package): void { if ($this->disablePlugins) { return; @@ -392,7 +392,7 @@ class PluginManager * * @return void */ - public function addPlugin(PluginInterface $plugin, $isGlobalPlugin = false, PackageInterface $sourcePackage = null) + public function addPlugin(PluginInterface $plugin, $isGlobalPlugin = false, PackageInterface $sourcePackage = null): void { if ($sourcePackage === null) { trigger_error('Calling PluginManager::addPlugin without $sourcePackage is deprecated, if you are using this please get in touch with us to explain the use case', E_USER_DEPRECATED); @@ -429,7 +429,7 @@ class PluginManager * * @return void */ - public function removePlugin(PluginInterface $plugin) + public function removePlugin(PluginInterface $plugin): void { $index = array_search($plugin, $this->plugins, true); if ($index === false) { @@ -454,7 +454,7 @@ class PluginManager * * @return void */ - public function uninstallPlugin(PluginInterface $plugin) + public function uninstallPlugin(PluginInterface $plugin): void { $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG); $plugin->uninstall($this->composer, $this->io); @@ -476,7 +476,7 @@ class PluginManager * * @throws \RuntimeException */ - private function loadRepository(RepositoryInterface $repo, $isGlobalRepo) + private function loadRepository(RepositoryInterface $repo, $isGlobalRepo): void { $packages = $repo->getPackages(); $sortedPackages = PackageSorter::sortPackages($packages); @@ -503,7 +503,7 @@ class PluginManager * * @return void */ - private function deactivateRepository(RepositoryInterface $repo, $isGlobalRepo) + private function deactivateRepository(RepositoryInterface $repo, $isGlobalRepo): void { $packages = $repo->getPackages(); $sortedPackages = array_reverse(PackageSorter::sortPackages($packages)); diff --git a/src/Composer/Plugin/PreFileDownloadEvent.php b/src/Composer/Plugin/PreFileDownloadEvent.php index 9e675d438..7dd56d416 100644 --- a/src/Composer/Plugin/PreFileDownloadEvent.php +++ b/src/Composer/Plugin/PreFileDownloadEvent.php @@ -95,7 +95,7 @@ class PreFileDownloadEvent extends Event * * @return void */ - public function setProcessedUrl($processedUrl) + public function setProcessedUrl($processedUrl): void { $this->processedUrl = $processedUrl; } @@ -117,7 +117,7 @@ class PreFileDownloadEvent extends Event * * @return void */ - public function setCustomCacheKey($customCacheKey) + public function setCustomCacheKey($customCacheKey): void { $this->customCacheKey = $customCacheKey; } @@ -166,7 +166,7 @@ class PreFileDownloadEvent extends Event * * @return void */ - public function setTransportOptions(array $options) + public function setTransportOptions(array $options): void { $this->transportOptions = $options; } diff --git a/src/Composer/Plugin/PrePoolCreateEvent.php b/src/Composer/Plugin/PrePoolCreateEvent.php index ff7702553..497e1d462 100644 --- a/src/Composer/Plugin/PrePoolCreateEvent.php +++ b/src/Composer/Plugin/PrePoolCreateEvent.php @@ -163,7 +163,7 @@ class PrePoolCreateEvent extends Event * * @return void */ - public function setPackages(array $packages) + public function setPackages(array $packages): void { $this->packages = $packages; } @@ -173,7 +173,7 @@ class PrePoolCreateEvent extends Event * * @return void */ - public function setUnacceptableFixedPackages(array $packages) + public function setUnacceptableFixedPackages(array $packages): void { $this->unacceptableFixedPackages = $packages; } diff --git a/src/Composer/Repository/CompositeRepository.php b/src/Composer/Repository/CompositeRepository.php index 83603081c..b25d0a0e1 100644 --- a/src/Composer/Repository/CompositeRepository.php +++ b/src/Composer/Repository/CompositeRepository.php @@ -166,7 +166,7 @@ class CompositeRepository implements RepositoryInterface /** * @return void */ - public function removePackage(PackageInterface $package) + public function removePackage(PackageInterface $package): void { foreach ($this->repositories as $repository) { if ($repository instanceof WritableRepositoryInterface) { @@ -195,7 +195,7 @@ class CompositeRepository implements RepositoryInterface * * @return void */ - public function addRepository(RepositoryInterface $repository) + public function addRepository(RepositoryInterface $repository): void { if ($repository instanceof self) { foreach ($repository->getRepositories() as $repo) { diff --git a/src/Composer/Repository/InstalledRepository.php b/src/Composer/Repository/InstalledRepository.php index db0967ba7..b5ceb983a 100644 --- a/src/Composer/Repository/InstalledRepository.php +++ b/src/Composer/Repository/InstalledRepository.php @@ -259,7 +259,7 @@ class InstalledRepository extends CompositeRepository /** * @inheritDoc */ - public function addRepository(RepositoryInterface $repository) + public function addRepository(RepositoryInterface $repository): void { if ( $repository instanceof LockArrayRepository diff --git a/src/Composer/Repository/PackageRepository.php b/src/Composer/Repository/PackageRepository.php index b787931ca..da3a01e2c 100644 --- a/src/Composer/Repository/PackageRepository.php +++ b/src/Composer/Repository/PackageRepository.php @@ -45,7 +45,7 @@ class PackageRepository extends ArrayRepository /** * Initializes repository (reads file, or remote address). */ - protected function initialize() + protected function initialize(): void { parent::initialize(); diff --git a/src/Composer/Repository/PathRepository.php b/src/Composer/Repository/PathRepository.php index 725a50360..bc86a9201 100644 --- a/src/Composer/Repository/PathRepository.php +++ b/src/Composer/Repository/PathRepository.php @@ -144,7 +144,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn * * This method will basically read the folder and add the found package. */ - protected function initialize() + protected function initialize(): void { parent::initialize(); diff --git a/src/Composer/Repository/PlatformRepository.php b/src/Composer/Repository/PlatformRepository.php index b1c98b61c..c1495f64d 100644 --- a/src/Composer/Repository/PlatformRepository.php +++ b/src/Composer/Repository/PlatformRepository.php @@ -106,7 +106,7 @@ class PlatformRepository extends ArrayRepository return $this->disabledPackages; } - protected function initialize() + protected function initialize(): void { parent::initialize(); @@ -531,7 +531,7 @@ class PlatformRepository extends ArrayRepository /** * @inheritDoc */ - public function addPackage(PackageInterface $package) + public function addPackage(PackageInterface $package): void { if (!$package instanceof CompletePackage) { throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package)); @@ -604,7 +604,7 @@ class PlatformRepository extends ArrayRepository /** * @return void */ - private function addDisabledPackage(CompletePackage $package) + private function addDisabledPackage(CompletePackage $package): void { $package->setDescription($package->getDescription().'. Package disabled via config.platform'); $package->setExtra(array('config.platform' => true)); @@ -620,7 +620,7 @@ class PlatformRepository extends ArrayRepository * * @return void */ - private function addExtension($name, $prettyVersion) + private function addExtension($name, $prettyVersion): void { $extraDescription = null; @@ -667,7 +667,7 @@ class PlatformRepository extends ArrayRepository * * @return void */ - private function addLibrary($name, $prettyVersion, $description = null, array $replaces = array(), array $provides = array()) + private function addLibrary($name, $prettyVersion, $description = null, array $replaces = array(), array $provides = array()): void { try { $version = $this->versionParser->normalize($prettyVersion); diff --git a/src/Composer/Repository/RepositorySet.php b/src/Composer/Repository/RepositorySet.php index eb640df2b..18b988b46 100644 --- a/src/Composer/Repository/RepositorySet.php +++ b/src/Composer/Repository/RepositorySet.php @@ -118,7 +118,7 @@ class RepositorySet * * @return void */ - public function allowInstalledRepositories($allow = true) + public function allowInstalledRepositories($allow = true): void { $this->allowInstalledRepositories = $allow; } @@ -142,7 +142,7 @@ class RepositorySet * * @return void */ - public function addRepository(RepositoryInterface $repo) + public function addRepository(RepositoryInterface $repo): void { if ($this->locked) { throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore."); diff --git a/src/Composer/Repository/Vcs/FossilDriver.php b/src/Composer/Repository/Vcs/FossilDriver.php index 66a50bdff..d15dd1e99 100644 --- a/src/Composer/Repository/Vcs/FossilDriver.php +++ b/src/Composer/Repository/Vcs/FossilDriver.php @@ -38,7 +38,7 @@ class FossilDriver extends VcsDriver /** * @inheritDoc */ - public function initialize() + public function initialize(): void { // Make sure fossil is installed and reachable. $this->checkFossil(); @@ -71,7 +71,7 @@ class FossilDriver extends VcsDriver * * @return void */ - protected function checkFossil() + protected function checkFossil(): void { if (0 !== $this->process->execute('fossil version', $ignoredOutput)) { throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput()); @@ -83,7 +83,7 @@ class FossilDriver extends VcsDriver * * @return void */ - protected function updateLocalRepo() + protected function updateLocalRepo(): void { $fs = new Filesystem(); $fs->ensureDirectoryExists($this->checkoutDir); diff --git a/src/Composer/Repository/Vcs/GitLabDriver.php b/src/Composer/Repository/Vcs/GitLabDriver.php index 2e7d36cc2..795f29e14 100644 --- a/src/Composer/Repository/Vcs/GitLabDriver.php +++ b/src/Composer/Repository/Vcs/GitLabDriver.php @@ -91,7 +91,7 @@ class GitLabDriver extends VcsDriver * * @inheritDoc */ - public function initialize() + public function initialize(): void { if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) { throw new \InvalidArgumentException(sprintf('The GitLab repository URL %s is invalid. It must be the HTTP URL of a GitLab project.', $this->url)); @@ -136,7 +136,7 @@ class GitLabDriver extends VcsDriver * * @return void */ - public function setHttpDownloader(HttpDownloader $httpDownloader) + public function setHttpDownloader(HttpDownloader $httpDownloader): void { $this->httpDownloader = $httpDownloader; } @@ -383,7 +383,7 @@ class GitLabDriver extends VcsDriver /** * @return void */ - protected function fetchProject() + protected function fetchProject(): void { // we need to fetch the default branch from the api $resource = $this->getApiUrl(); @@ -452,7 +452,7 @@ class GitLabDriver extends VcsDriver * * @return void */ - protected function setupGitDriver($url) + protected function setupGitDriver($url): void { $this->gitDriver = new GitDriver( array('url' => $url), diff --git a/src/Composer/SelfUpdate/Versions.php b/src/Composer/SelfUpdate/Versions.php index 9e617fb13..b6ba9c48f 100644 --- a/src/Composer/SelfUpdate/Versions.php +++ b/src/Composer/SelfUpdate/Versions.php @@ -63,7 +63,7 @@ class Versions * * @return void */ - public function setChannel($channel) + public function setChannel($channel): void { if (!in_array($channel, self::$channels, true)) { throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels)); diff --git a/src/Composer/Util/AuthHelper.php b/src/Composer/Util/AuthHelper.php index 28c4aba68..b9e178875 100644 --- a/src/Composer/Util/AuthHelper.php +++ b/src/Composer/Util/AuthHelper.php @@ -41,7 +41,7 @@ class AuthHelper * * @return void */ - public function storeAuth($origin, $storeAuth) + public function storeAuth($origin, $storeAuth): void { $store = false; $configSource = $this->config->getAuthConfigSource(); diff --git a/src/Composer/Util/Bitbucket.php b/src/Composer/Util/Bitbucket.php index 62a46c1c5..e0104a64b 100644 --- a/src/Composer/Util/Bitbucket.php +++ b/src/Composer/Util/Bitbucket.php @@ -223,7 +223,7 @@ class Bitbucket * * @return void */ - private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret) + private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret): void { $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl); diff --git a/src/Composer/Util/ErrorHandler.php b/src/Composer/Util/ErrorHandler.php index 5e2bc1790..fc60bf3f1 100644 --- a/src/Composer/Util/ErrorHandler.php +++ b/src/Composer/Util/ErrorHandler.php @@ -76,7 +76,7 @@ class ErrorHandler * * @return void */ - public static function register(IOInterface $io = null) + public static function register(IOInterface $io = null): void { set_error_handler(array(__CLASS__, 'handle')); error_reporting(E_ALL | E_STRICT); diff --git a/src/Composer/Util/Hg.php b/src/Composer/Util/Hg.php index 73e3a8e52..34dc00623 100644 --- a/src/Composer/Util/Hg.php +++ b/src/Composer/Util/Hg.php @@ -53,7 +53,7 @@ class Hg * * @return void */ - public function runCommand($commandCallable, $url, $cwd) + public function runCommand($commandCallable, $url, $cwd): void { $this->config->prohibitUrlByConfig($url, $this->io); diff --git a/src/Composer/Util/Http/CurlDownloader.php b/src/Composer/Util/Http/CurlDownloader.php index a53fd7fb7..8ae18ee4c 100644 --- a/src/Composer/Util/Http/CurlDownloader.php +++ b/src/Composer/Util/Http/CurlDownloader.php @@ -180,7 +180,7 @@ class CurlDownloader if ($copyTo) { $errorMessage = ''; // @phpstan-ignore-next-line - set_error_handler(function ($code, $msg) use (&$errorMessage) { + set_error_handler(function ($code, $msg) use (&$errorMessage): void { if ($errorMessage) { $errorMessage .= "\n"; } @@ -287,7 +287,7 @@ class CurlDownloader * @param int $id * @return void */ - public function abortRequest($id) + public function abortRequest($id): void { if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) { $job = $this->jobs[$id]; @@ -309,7 +309,7 @@ class CurlDownloader /** * @return void */ - public function tick() + public function tick(): void { static $timeoutWarning = false; @@ -579,7 +579,7 @@ class CurlDownloader * * @return void */ - private function restartJob(array $job, $url, array $attributes = array()) + private function restartJob(array $job, $url, array $attributes = array()): void { if (null !== $job['filename']) { @unlink($job['filename'].'~'); @@ -614,7 +614,7 @@ class CurlDownloader * @param Job $job * @return void */ - private function rejectJob(array $job, \Exception $e) + private function rejectJob(array $job, \Exception $e): void { if (is_resource($job['headerHandle'])) { fclose($job['headerHandle']); @@ -632,7 +632,7 @@ class CurlDownloader * @param int $code * @return void */ - private function checkCurlResult($code) + private function checkCurlResult($code): void { if ($code != CURLM_OK && $code != CURLM_CALL_MULTI_PERFORM) { throw new \RuntimeException( diff --git a/src/Composer/Util/Http/ProxyHelper.php b/src/Composer/Util/Http/ProxyHelper.php index febcfc73d..bfdfe2e4a 100644 --- a/src/Composer/Util/Http/ProxyHelper.php +++ b/src/Composer/Util/Http/ProxyHelper.php @@ -97,7 +97,7 @@ class ProxyHelper * * @return void */ - public static function setRequestFullUri($requestUrl, array &$options) + public static function setRequestFullUri($requestUrl, array &$options): void { if ('http' === parse_url($requestUrl, PHP_URL_SCHEME)) { $options['http']['request_fulluri'] = true; diff --git a/src/Composer/Util/Http/ProxyManager.php b/src/Composer/Util/Http/ProxyManager.php index 352ab8d35..43bcea749 100644 --- a/src/Composer/Util/Http/ProxyManager.php +++ b/src/Composer/Util/Http/ProxyManager.php @@ -72,7 +72,7 @@ class ProxyManager * * @return void */ - public static function reset() + public static function reset(): void { self::$instance = null; } @@ -133,7 +133,7 @@ class ProxyManager * * @return void */ - private function initProxyData() + private function initProxyData(): void { try { list($httpProxy, $httpsProxy, $noProxy) = ProxyHelper::getProxyData(); diff --git a/src/Composer/Util/Http/Response.php b/src/Composer/Util/Http/Response.php index 39c68d6f2..1ce384473 100644 --- a/src/Composer/Util/Http/Response.php +++ b/src/Composer/Util/Http/Response.php @@ -109,7 +109,7 @@ class Response * @return void * @phpstan-impure */ - public function collect() + public function collect(): void { /** @phpstan-ignore-next-line */ $this->request = $this->code = $this->headers = $this->body = null; diff --git a/src/Composer/Util/Loop.php b/src/Composer/Util/Loop.php index b103011a4..2be438a50 100644 --- a/src/Composer/Util/Loop.php +++ b/src/Composer/Util/Loop.php @@ -62,15 +62,15 @@ class Loop * @param ?ProgressBar $progress * @return void */ - public function wait(array $promises, ProgressBar $progress = null) + public function wait(array $promises, ProgressBar $progress = null): void { /** @var \Exception|null */ $uncaught = null; \React\Promise\all($promises)->then( - function () { + function (): void { }, - function ($e) use (&$uncaught) { + function ($e) use (&$uncaught): void { $uncaught = $e; } ); @@ -122,7 +122,7 @@ class Loop /** * @return void */ - public function abortJobs() + public function abortJobs(): void { foreach ($this->currentPromises as $promiseGroup) { foreach ($promiseGroup as $promise) { diff --git a/src/Composer/Util/PackageSorter.php b/src/Composer/Util/PackageSorter.php index df2d89a4b..a28e95b11 100644 --- a/src/Composer/Util/PackageSorter.php +++ b/src/Composer/Util/PackageSorter.php @@ -69,17 +69,17 @@ class PackageSorter $weightList[$index] = $weight; } - $stable_sort = function (&$array) { + $stable_sort = function (&$array): void { static $transform, $restore; $i = 0; if (!$transform) { - $transform = function (&$v, $k) use (&$i) { + $transform = function (&$v, $k) use (&$i): void { $v = array($v, ++$i, $k, $v); }; - $restore = function (&$v) { + $restore = function (&$v): void { $v = $v[3]; }; } diff --git a/src/Composer/Util/Platform.php b/src/Composer/Util/Platform.php index 756c11506..b57b7dda8 100644 --- a/src/Composer/Util/Platform.php +++ b/src/Composer/Util/Platform.php @@ -51,7 +51,7 @@ class Platform * @param string $value * @return void */ - public static function putEnv($name, $value) + public static function putEnv($name, $value): void { $value = (string) $value; putenv($name . '=' . $value); @@ -64,7 +64,7 @@ class Platform * @param string $name * @return void */ - public static function clearEnv($name) + public static function clearEnv($name): void { putenv($name); unset($_SERVER[$name], $_ENV[$name]); @@ -202,7 +202,7 @@ class Platform /** * @return void */ - public static function workaroundFilesystemIssues() + public static function workaroundFilesystemIssues(): void { if (self::isVirtualBoxGuest()) { usleep(200000); diff --git a/src/Composer/Util/Silencer.php b/src/Composer/Util/Silencer.php index 361ef41f6..b4164b1cc 100644 --- a/src/Composer/Util/Silencer.php +++ b/src/Composer/Util/Silencer.php @@ -47,7 +47,7 @@ class Silencer * * @return void */ - public static function restore() + public static function restore(): void { if (!empty(self::$stack)) { error_reporting(array_pop(self::$stack)); diff --git a/src/Composer/Util/Svn.php b/src/Composer/Util/Svn.php index 865479e9a..c04f075df 100644 --- a/src/Composer/Util/Svn.php +++ b/src/Composer/Util/Svn.php @@ -86,7 +86,7 @@ class Svn /** * @return void */ - public static function cleanEnv() + public static function cleanEnv(): void { // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940 Platform::clearEnv('DYLD_LIBRARY_PATH'); @@ -194,7 +194,7 @@ class Svn * @param bool $cacheCredentials * @return void */ - public function setCacheCredentials($cacheCredentials) + public function setCacheCredentials($cacheCredentials): void { $this->cacheCredentials = $cacheCredentials; } diff --git a/src/Composer/Util/SyncHelper.php b/src/Composer/Util/SyncHelper.php index 9e8c5d710..f61d02dbe 100644 --- a/src/Composer/Util/SyncHelper.php +++ b/src/Composer/Util/SyncHelper.php @@ -31,7 +31,7 @@ class SyncHelper * * @return void */ - public static function downloadAndInstallPackageSync(Loop $loop, DownloaderInterface $downloader, $path, PackageInterface $package, PackageInterface $prevPackage = null) + public static function downloadAndInstallPackageSync(Loop $loop, DownloaderInterface $downloader, $path, PackageInterface $package, PackageInterface $prevPackage = null): void { $type = $prevPackage ? 'update' : 'install'; @@ -61,7 +61,7 @@ class SyncHelper * * @return void */ - public static function await(Loop $loop, PromiseInterface $promise = null) + public static function await(Loop $loop, PromiseInterface $promise = null): void { if ($promise) { $loop->wait(array($promise)); diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index d1f6394e4..896079f89 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -63,7 +63,7 @@ class AllFunctionalTest extends TestCase $fs->removeDirectory(dirname(self::$pharPath)); } - public function testBuildPhar() + public function testBuildPhar(): void { if (defined('HHVM_VERSION')) { $this->markTestSkipped('Building the phar does not work on HHVM.'); @@ -100,7 +100,7 @@ class AllFunctionalTest extends TestCase * @depends testBuildPhar * @param string $testFile */ - public function testIntegration($testFile) + public function testIntegration($testFile): void { $testData = $this->parseTestFile($testFile); $this->testDir = self::getUniqueTmpDirectory(); @@ -121,7 +121,7 @@ class AllFunctionalTest extends TestCase $proc = Process::fromShellCommandline(escapeshellcmd(PHP_BINARY).' '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'], $this->testDir, $env, null, 300); $output = ''; - $exitCode = $proc->run(function ($type, $buffer) use (&$output) { + $exitCode = $proc->run(function ($type, $buffer) use (&$output): void { $output .= $buffer; }); diff --git a/tests/Composer/Test/ApplicationTest.php b/tests/Composer/Test/ApplicationTest.php index ed182360e..30aab4988 100644 --- a/tests/Composer/Test/ApplicationTest.php +++ b/tests/Composer/Test/ApplicationTest.php @@ -25,7 +25,7 @@ class ApplicationTest extends TestCase putenv('COMPOSER_NO_INTERACTION'); } - public function testDevWarning() + public function testDevWarning(): void { $application = new Application; @@ -84,7 +84,7 @@ class ApplicationTest extends TestCase * @param string $command * @return void */ - public function ensureNoDevWarning($command) + public function ensureNoDevWarning($command): void { $application = new Application; @@ -133,12 +133,12 @@ class ApplicationTest extends TestCase $application->doRun($inputMock, $outputMock); } - public function testDevWarningPrevented() + public function testDevWarningPrevented(): void { $this->ensureNoDevWarning('self-update'); } - public function testDevWarningPreventedAlias() + public function testDevWarningPreventedAlias(): void { $this->ensureNoDevWarning('self-up'); } diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 96f8d4584..ca5af8273 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -161,7 +161,7 @@ class AutoloadGeneratorTest extends TestCase } } - public function testRootPackageAutoloading() + public function testRootPackageAutoloading(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -206,7 +206,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap'); } - public function testRootPackageDevAutoloading() + public function testRootPackageDevAutoloading(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -244,7 +244,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files'); } - public function testRootPackageDevAutoloadingDisabledByDefault() + public function testRootPackageDevAutoloadingDisabledByDefault(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -277,7 +277,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php')); } - public function testVendorDirSameAsWorkingDir() + public function testVendorDirSameAsWorkingDir(): void { $this->vendorDir = $this->workingDir; @@ -308,7 +308,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap'); } - public function testRootPackageAutoloadingAlternativeVendorDir() + public function testRootPackageAutoloadingAlternativeVendorDir(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -337,7 +337,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap'); } - public function testRootPackageAutoloadingWithTargetDir() + public function testRootPackageAutoloadingWithTargetDir(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -368,7 +368,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap'); } - public function testVendorsAutoloading() + public function testVendorsAutoloading(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -397,7 +397,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } - public function testNonDevAutoloadExclusionWithRecursion() + public function testNonDevAutoloadExclusionWithRecursion(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -430,7 +430,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } - public function testNonDevAutoloadShouldIncludeReplacedPackages() + public function testNonDevAutoloadShouldIncludeReplacedPackages(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array('a/a' => new Link('a', 'a/a', new MatchAllConstraint()))); @@ -464,7 +464,7 @@ class AutoloadGeneratorTest extends TestCase ); } - public function testNonDevAutoloadExclusionWithRecursionReplace() + public function testNonDevAutoloadExclusionWithRecursionReplace(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -497,7 +497,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertFileExists($this->vendorDir.'/composer/autoload_classmap.php', "ClassMap file needs to be generated, even if empty."); } - public function testNonDevAutoloadReplacesNestedRequirements() + public function testNonDevAutoloadReplacesNestedRequirements(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -549,7 +549,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap'); } - public function testPharAutoload() + public function testPharAutoload(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -590,7 +590,7 @@ class AutoloadGeneratorTest extends TestCase $this->assertAutoloadFiles('phar_static', $this->vendorDir . '/composer', 'static'); } - public function testPSRToClassMapIgnoresNonExistingDir() + public function testPSRToClassMapIgnoresNonExistingDir(): void { $package = new RootPackage('root/a', '1.0', '1.0'); @@ -613,7 +613,7 @@ class AutoloadGeneratorTest extends TestCase ); } - public function testPSRToClassMapIgnoresNonPSRClasses() + public function testPSRToClassMapIgnoresNonPSRClasses(): void { $package = new RootPackage('root/a', '1.0', '1.0'); @@ -654,7 +654,7 @@ EOF; $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); } - public function testVendorsClassMapAutoloading() + public function testVendorsClassMapAutoloading(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -694,7 +694,7 @@ EOF; $this->assertAutoloadFiles('classmap4', $this->vendorDir.'/composer', 'classmap'); } - public function testVendorsClassMapAutoloadingWithTargetDir() + public function testVendorsClassMapAutoloadingWithTargetDir(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -734,7 +734,7 @@ EOF; ); } - public function testClassMapAutoloadingEmptyDirAndExactFile() + public function testClassMapAutoloadingEmptyDirAndExactFile(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -779,7 +779,7 @@ EOF; $this->assertStringNotContainsString('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); } - public function testClassMapAutoloadingAuthoritativeAndApcu() + public function testClassMapAutoloadingAuthoritativeAndApcu(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -828,7 +828,7 @@ EOF; $this->assertStringContainsString('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); } - public function testClassMapAutoloadingAuthoritativeAndApcuPrefix() + public function testClassMapAutoloadingAuthoritativeAndApcuPrefix(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires(array( @@ -877,7 +877,7 @@ EOF; $this->assertStringContainsString('$loader->setApcuPrefix(\'custom\\\'Prefix\');', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); } - public function testFilesAutoloadGeneration() + public function testFilesAutoloadGeneration(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array('files' => array('root.php'))); @@ -924,7 +924,7 @@ EOF; $this->assertTrue(function_exists('testFilesAutoloadGenerationRoot')); } - public function testFilesAutoloadGenerationRemoveExtraEntitiesFromAutoloadFiles() + public function testFilesAutoloadGenerationRemoveExtraEntitiesFromAutoloadFiles(): void { $autoloadPackage = new RootPackage('root/a', '1.0', '1.0'); $autoloadPackage->setAutoload(array('files' => array('root.php'))); @@ -995,7 +995,7 @@ EOF; $this->assertFileDoesNotExist($this->vendorDir.'/composer/include_paths.php'); } - public function testFilesAutoloadOrderByDependencies() + public function testFilesAutoloadOrderByDependencies(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array('files' => array('root2.php'))); @@ -1065,7 +1065,7 @@ EOF; * - The main package has priority over other packages. * - Longer namespaces have priority over shorter namespaces. */ - public function testOverrideVendorsAutoloading() + public function testOverrideVendorsAutoloading(): void { $rootPackage = new RootPackage('root/z', '1.0', '1.0'); $rootPackage->setAutoload(array( @@ -1160,7 +1160,7 @@ EOF; $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); } - public function testIncludePathFileGeneration() + public function testIncludePathFileGeneration(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $packages = array(); @@ -1197,7 +1197,7 @@ EOF; ); } - public function testIncludePathsArePrependedInAutoloadFile() + public function testIncludePathsArePrependedInAutoloadFile(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $packages = array(); @@ -1228,7 +1228,7 @@ EOF; set_include_path($oldIncludePath); } - public function testIncludePathsInRootPackage() + public function testIncludePathsInRootPackage(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setIncludePaths(array('/lib', '/src')); @@ -1257,7 +1257,7 @@ EOF; set_include_path($oldIncludePath); } - public function testIncludePathFileWithoutPathsIsSkipped() + public function testIncludePathFileWithoutPathsIsSkipped(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $packages = array(); @@ -1276,7 +1276,7 @@ EOF; $this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php"); } - public function testPreAndPostEventsAreDispatchedDuringAutoloadDump() + public function testPreAndPostEventsAreDispatchedDuringAutoloadDump(): void { $this->eventDispatcher ->expects($this->exactly(2)) @@ -1297,7 +1297,7 @@ EOF; $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); } - public function testUseGlobalIncludePath() + public function testUseGlobalIncludePath(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -1318,7 +1318,7 @@ EOF; $this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php'); } - public function testVendorDirExcludedFromWorkingDir() + public function testVendorDirExcludedFromWorkingDir(): void { $workingDir = $this->vendorDir.'/working-dir'; $vendorDir = $workingDir.'/../vendor'; @@ -1432,7 +1432,7 @@ EOF; $this->assertStringContainsString("\$baseDir . '/test.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php')); } - public function testUpLevelRelativePaths() + public function testUpLevelRelativePaths(): void { $workingDir = $this->workingDir.'/working-dir'; mkdir($workingDir, 0777, true); @@ -1516,7 +1516,7 @@ EOF; $this->assertStringContainsString("\$baseDir . '/../test.php',\n", file_get_contents($this->vendorDir.'/composer/autoload_files.php')); } - public function testEmptyPaths() + public function testEmptyPaths(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -1584,7 +1584,7 @@ EOF; $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); } - public function testVendorSubstringPath() + public function testVendorSubstringPath(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -1631,7 +1631,7 @@ EOF; $this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); } - public function testExcludeFromClassmap() + public function testExcludeFromClassmap(): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setAutoload(array( @@ -1709,7 +1709,7 @@ EOF; * * @dataProvider platformCheckProvider */ - public function testGeneratesPlatformCheck(array $requires, $expectedFixture, array $provides = array(), array $replaces = array(), $ignorePlatformReqs = false) + public function testGeneratesPlatformCheck(array $requires, $expectedFixture, array $provides = array(), array $replaces = array(), $ignorePlatformReqs = false): void { $package = new RootPackage('root/a', '1.0', '1.0'); $package->setRequires($requires); @@ -1850,7 +1850,7 @@ EOF; * * @return void */ - private function assertAutoloadFiles($name, $dir, $type = 'namespaces') + private function assertAutoloadFiles($name, $dir, $type = 'namespaces'): void { $a = __DIR__.'/Fixtures/autoload_'.$name.'.php'; $b = $dir.'/autoload_'.$type.'.php'; @@ -1864,7 +1864,7 @@ EOF; * * @return void */ - public static function assertFileContentEquals(string $expected, string $actual, ?string $message = null) + public static function assertFileContentEquals(string $expected, string $actual, ?string $message = null): void { self::assertSame( str_replace("\r", '', (string) file_get_contents($expected)), diff --git a/tests/Composer/Test/Autoload/ClassLoaderTest.php b/tests/Composer/Test/Autoload/ClassLoaderTest.php index f20c764d2..7b1f7ab7b 100644 --- a/tests/Composer/Test/Autoload/ClassLoaderTest.php +++ b/tests/Composer/Test/Autoload/ClassLoaderTest.php @@ -27,7 +27,7 @@ class ClassLoaderTest extends TestCase * * @param string $class The fully-qualified class name to test, without preceding namespace separator. */ - public function testLoadClass($class) + public function testLoadClass($class): void { $loader = new ClassLoader(); $loader->add('Namespaced\\', __DIR__ . '/Fixtures'); @@ -54,7 +54,7 @@ class ClassLoaderTest extends TestCase /** * getPrefixes method should return empty array if ClassLoader does not have any psr-0 configuration */ - public function testGetPrefixesWithNoPSR0Configuration() + public function testGetPrefixesWithNoPSR0Configuration(): void { $loader = new ClassLoader(); $this->assertEmpty($loader->getPrefixes()); diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 6316ceb26..8f4fd1395 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -30,7 +30,7 @@ class ClassMapGeneratorTest extends TestCase * @param string $directory * @param array $expected */ - public function testCreateMap($directory, $expected) + public function testCreateMap($directory, $expected): void { $this->assertEqualsNormalized($expected, ClassMapGenerator::createMap($directory)); } @@ -120,7 +120,7 @@ class ClassMapGeneratorTest extends TestCase return $data; } - public function testCreateMapFinderSupport() + public function testCreateMapFinderSupport(): void { $this->checkIfFinderIsAvailable(); @@ -133,7 +133,7 @@ class ClassMapGeneratorTest extends TestCase ), ClassMapGenerator::createMap($finder)); } - public function testFindClassesThrowsWhenFileDoesNotExist() + public function testFindClassesThrowsWhenFileDoesNotExist(): void { $r = new \ReflectionClass('Composer\\Autoload\\ClassMapGenerator'); $find = $r->getMethod('findClasses'); @@ -144,7 +144,7 @@ class ClassMapGeneratorTest extends TestCase $find->invoke(null, __DIR__ . '/no-file'); } - public function testAmbiguousReference() + public function testAmbiguousReference(): void { $this->checkIfFinderIsAvailable(); @@ -167,7 +167,7 @@ class ClassMapGeneratorTest extends TestCase $io->expects($this->once()) ->method('writeError') - ->will($this->returnCallback(function ($text) use (&$msg) { + ->will($this->returnCallback(function ($text) use (&$msg): void { $msg = $text; })); @@ -188,7 +188,7 @@ class ClassMapGeneratorTest extends TestCase * If one file has a class or interface defined more than once, * an ambiguous reference warning should not be produced */ - public function testUnambiguousReference() + public function testUnambiguousReference(): void { $tempDir = $this->getUniqueTmpDirectory(); @@ -224,14 +224,14 @@ class ClassMapGeneratorTest extends TestCase $fs->removeDirectory($tempDir); } - public function testCreateMapThrowsWhenDirectoryDoesNotExist() + public function testCreateMapThrowsWhenDirectoryDoesNotExist(): void { self::expectException('RuntimeException'); self::expectExceptionMessage('Could not scan for classes inside'); ClassMapGenerator::createMap(__DIR__ . '/no-file.no-foler'); } - public function testDump() + public function testDump(): void { $tempDir = self::getUniqueTmpDirectory(); @@ -249,7 +249,7 @@ class ClassMapGeneratorTest extends TestCase $fs->removeDirectory($tempDir); } - public function testCreateMapDoesNotHitRegexBacktraceLimit() + public function testCreateMapDoesNotHitRegexBacktraceLimit(): void { $expected = array( 'Foo\\StripNoise' => realpath(__DIR__) . '/Fixtures/pcrebacktracelimit/StripNoise.php', @@ -274,7 +274,7 @@ class ClassMapGeneratorTest extends TestCase * @param string $message * @return void */ - protected function assertEqualsNormalized($expected, $actual, $message = '') + protected function assertEqualsNormalized($expected, $actual, $message = ''): void { foreach ($expected as $ns => $path) { $expected[$ns] = strtr($path, '\\', '/'); @@ -286,7 +286,7 @@ class ClassMapGeneratorTest extends TestCase } /** @return void */ - private function checkIfFinderIsAvailable() + private function checkIfFinderIsAvailable(): void { if (!class_exists('Symfony\\Component\\Finder\\Finder')) { $this->markTestSkipped('Finder component is not available'); diff --git a/tests/Composer/Test/CacheTest.php b/tests/Composer/Test/CacheTest.php index 4bc0c3994..6b83ac961 100644 --- a/tests/Composer/Test/CacheTest.php +++ b/tests/Composer/Test/CacheTest.php @@ -62,7 +62,7 @@ class CacheTest extends TestCase } } - public function testRemoveOutdatedFiles() + public function testRemoveOutdatedFiles(): void { $outdated = array_slice($this->files, 1); $this->finder @@ -82,7 +82,7 @@ class CacheTest extends TestCase $this->assertFileExists("{$this->root}/cached.file0.zip"); } - public function testRemoveFilesWhenCacheIsTooLarge() + public function testRemoveFilesWhenCacheIsTooLarge(): void { $emptyFinder = $this->getMockBuilder('Symfony\Component\Finder\Finder')->disableOriginalConstructor()->getMock(); $emptyFinder @@ -111,7 +111,7 @@ class CacheTest extends TestCase $this->assertFileExists("{$this->root}/cached.file3.zip"); } - public function testClearCache() + public function testClearCache(): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $cache = new Cache($io, $this->root, 'a-z0-9.', $this->filesystem); diff --git a/tests/Composer/Test/Command/ArchiveCommandTest.php b/tests/Composer/Test/Command/ArchiveCommandTest.php index fda64ba7a..88cc15fe1 100644 --- a/tests/Composer/Test/Command/ArchiveCommandTest.php +++ b/tests/Composer/Test/Command/ArchiveCommandTest.php @@ -20,7 +20,7 @@ use Symfony\Component\Console\Input\ArrayInput; class ArchiveCommandTest extends TestCase { - public function testUsesConfigFromComposerObject() + public function testUsesConfigFromComposerObject(): void { $input = new ArrayInput(array()); @@ -64,7 +64,7 @@ class ArchiveCommandTest extends TestCase $command->run($input, $output); } - public function testUsesConfigFromFactoryWhenComposerIsNotDefined() + public function testUsesConfigFromFactoryWhenComposerIsNotDefined(): void { $input = new ArrayInput(array()); diff --git a/tests/Composer/Test/Command/InitCommandTest.php b/tests/Composer/Test/Command/InitCommandTest.php index 22950158e..69af6cfbc 100644 --- a/tests/Composer/Test/Command/InitCommandTest.php +++ b/tests/Composer/Test/Command/InitCommandTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class InitCommandTest extends TestCase { - public function testParseValidAuthorString() + public function testParseValidAuthorString(): void { $command = new InitCommand; $author = $command->parseAuthorString('John Smith '); @@ -25,7 +25,7 @@ class InitCommandTest extends TestCase $this->assertEquals('john@example.com', $author['email']); } - public function testParseValidAuthorStringWithoutEmail() + public function testParseValidAuthorStringWithoutEmail(): void { $command = new InitCommand; $author = $command->parseAuthorString('John Smith'); @@ -33,7 +33,7 @@ class InitCommandTest extends TestCase $this->assertNull($author['email']); } - public function testParseValidUtf8AuthorString() + public function testParseValidUtf8AuthorString(): void { $command = new InitCommand; $author = $command->parseAuthorString('Matti Meikäläinen '); @@ -41,7 +41,7 @@ class InitCommandTest extends TestCase $this->assertEquals('matti@example.com', $author['email']); } - public function testParseValidUtf8AuthorStringWithNonSpacingMarks() + public function testParseValidUtf8AuthorStringWithNonSpacingMarks(): void { // \xCC\x88 is UTF-8 for U+0308 diaeresis (umlaut) combining mark $utf8_expected = "Matti Meika\xCC\x88la\xCC\x88inen"; @@ -51,7 +51,7 @@ class InitCommandTest extends TestCase $this->assertEquals('matti@example.com', $author['email']); } - public function testParseNumericAuthorString() + public function testParseNumericAuthorString(): void { $command = new InitCommand; $author = $command->parseAuthorString('h4x0r '); @@ -63,7 +63,7 @@ class InitCommandTest extends TestCase * Test scenario for issue #5631 * @link https://github.com/composer/composer/issues/5631 Issue #5631 */ - public function testParseValidAlias1AuthorString() + public function testParseValidAlias1AuthorString(): void { $command = new InitCommand; $author = $command->parseAuthorString( @@ -77,7 +77,7 @@ class InitCommandTest extends TestCase * Test scenario for issue #5631 * @link https://github.com/composer/composer/issues/5631 Issue #5631 */ - public function testParseValidAlias2AuthorString() + public function testParseValidAlias2AuthorString(): void { $command = new InitCommand; $author = $command->parseAuthorString( @@ -87,35 +87,35 @@ class InitCommandTest extends TestCase $this->assertEquals('john@example.com', $author['email']); } - public function testParseEmptyAuthorString() + public function testParseEmptyAuthorString(): void { $command = new InitCommand; self::expectException('InvalidArgumentException'); $command->parseAuthorString(''); } - public function testParseAuthorStringWithInvalidEmail() + public function testParseAuthorStringWithInvalidEmail(): void { $command = new InitCommand; self::expectException('InvalidArgumentException'); $command->parseAuthorString('John Smith '); } - public function testNamespaceFromValidPackageName() + public function testNamespaceFromValidPackageName(): void { $command = new InitCommand; $namespace = $command->namespaceFromPackageName('new_projects.acme-extra/package-name'); $this->assertEquals('NewProjectsAcmeExtra\PackageName', $namespace); } - public function testNamespaceFromInvalidPackageName() + public function testNamespaceFromInvalidPackageName(): void { $command = new InitCommand; $namespace = $command->namespaceFromPackageName('invalid-package-name'); $this->assertNull($namespace); } - public function testNamespaceFromMissingPackageName() + public function testNamespaceFromMissingPackageName(): void { $command = new InitCommand; $namespace = $command->namespaceFromPackageName(''); diff --git a/tests/Composer/Test/Command/RunScriptCommandTest.php b/tests/Composer/Test/Command/RunScriptCommandTest.php index eaffdbd92..fcae19051 100644 --- a/tests/Composer/Test/Command/RunScriptCommandTest.php +++ b/tests/Composer/Test/Command/RunScriptCommandTest.php @@ -24,7 +24,7 @@ class RunScriptCommandTest extends TestCase * @param bool $dev * @param bool $noDev */ - public function testDetectAndPassDevModeToEventAndToDispatching($dev, $noDev) + public function testDetectAndPassDevModeToEventAndToDispatching($dev, $noDev): void { $scriptName = 'testScript'; diff --git a/tests/Composer/Test/ComposerTest.php b/tests/Composer/Test/ComposerTest.php index 1ba78abea..216245a49 100644 --- a/tests/Composer/Test/ComposerTest.php +++ b/tests/Composer/Test/ComposerTest.php @@ -16,7 +16,7 @@ use Composer\Composer; class ComposerTest extends TestCase { - public function testSetGetPackage() + public function testSetGetPackage(): void { $composer = new Composer(); $package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); @@ -25,7 +25,7 @@ class ComposerTest extends TestCase $this->assertSame($package, $composer->getPackage()); } - public function testSetGetLocker() + public function testSetGetLocker(): void { $composer = new Composer(); $locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock(); @@ -34,7 +34,7 @@ class ComposerTest extends TestCase $this->assertSame($locker, $composer->getLocker()); } - public function testSetGetRepositoryManager() + public function testSetGetRepositoryManager(): void { $composer = new Composer(); $manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock(); @@ -43,7 +43,7 @@ class ComposerTest extends TestCase $this->assertSame($manager, $composer->getRepositoryManager()); } - public function testSetGetDownloadManager() + public function testSetGetDownloadManager(): void { $composer = new Composer(); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); @@ -53,7 +53,7 @@ class ComposerTest extends TestCase $this->assertSame($manager, $composer->getDownloadManager()); } - public function testSetGetInstallationManager() + public function testSetGetInstallationManager(): void { $composer = new Composer(); $manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock(); diff --git a/tests/Composer/Test/Config/JsonConfigSourceTest.php b/tests/Composer/Test/Config/JsonConfigSourceTest.php index 3d9e68980..bcc193662 100644 --- a/tests/Composer/Test/Config/JsonConfigSourceTest.php +++ b/tests/Composer/Test/Config/JsonConfigSourceTest.php @@ -48,7 +48,7 @@ class JsonConfigSourceTest extends TestCase } } - public function testAddRepository() + public function testAddRepository(): void { $config = $this->workingDir.'/composer.json'; copy($this->fixturePath('composer-repositories.json'), $config); @@ -58,7 +58,7 @@ class JsonConfigSourceTest extends TestCase $this->assertFileEquals($this->fixturePath('config/config-with-exampletld-repository.json'), $config); } - public function testAddRepositoryWithOptions() + public function testAddRepositoryWithOptions(): void { $config = $this->workingDir.'/composer.json'; copy($this->fixturePath('composer-repositories.json'), $config); @@ -76,7 +76,7 @@ class JsonConfigSourceTest extends TestCase $this->assertFileEquals($this->fixturePath('config/config-with-exampletld-repository-and-options.json'), $config); } - public function testRemoveRepository() + public function testRemoveRepository(): void { $config = $this->workingDir.'/composer.json'; copy($this->fixturePath('config/config-with-exampletld-repository.json'), $config); @@ -86,7 +86,7 @@ class JsonConfigSourceTest extends TestCase $this->assertFileEquals($this->fixturePath('composer-repositories.json'), $config); } - public function testAddPackagistRepositoryWithFalseValue() + public function testAddPackagistRepositoryWithFalseValue(): void { $config = $this->workingDir.'/composer.json'; copy($this->fixturePath('composer-repositories.json'), $config); @@ -96,7 +96,7 @@ class JsonConfigSourceTest extends TestCase $this->assertFileEquals($this->fixturePath('config/config-with-packagist-false.json'), $config); } - public function testRemovePackagist() + public function testRemovePackagist(): void { $config = $this->workingDir.'/composer.json'; copy($this->fixturePath('config/config-with-packagist-false.json'), $config); @@ -117,7 +117,7 @@ class JsonConfigSourceTest extends TestCase * * @dataProvider provideAddLinkData */ - public function testAddLink($sourceFile, $type, $name, $value, $compareAgainst) + public function testAddLink($sourceFile, $type, $name, $value, $compareAgainst): void { $composerJson = $this->workingDir.'/composer.json'; copy($sourceFile, $composerJson); @@ -138,7 +138,7 @@ class JsonConfigSourceTest extends TestCase * * @dataProvider provideRemoveLinkData */ - public function testRemoveLink($sourceFile, $type, $name, $compareAgainst) + public function testRemoveLink($sourceFile, $type, $name, $compareAgainst): void { $composerJson = $this->workingDir.'/composer.json'; copy($sourceFile, $composerJson); diff --git a/tests/Composer/Test/ConfigTest.php b/tests/Composer/Test/ConfigTest.php index fc829c159..0aad6141c 100644 --- a/tests/Composer/Test/ConfigTest.php +++ b/tests/Composer/Test/ConfigTest.php @@ -23,7 +23,7 @@ class ConfigTest extends TestCase * @param mixed[] $localConfig * @param ?mixed[] $systemConfig */ - public function testAddPackagistRepository($expected, $localConfig, $systemConfig = null) + public function testAddPackagistRepository($expected, $localConfig, $systemConfig = null): void { $config = new Config(false); if ($systemConfig) { @@ -141,7 +141,7 @@ class ConfigTest extends TestCase return $data; } - public function testPreferredInstallAsString() + public function testPreferredInstallAsString(): void { $config = new Config(false); $config->merge(array('config' => array('preferred-install' => 'source'))); @@ -150,7 +150,7 @@ class ConfigTest extends TestCase $this->assertEquals('dist', $config->get('preferred-install')); } - public function testMergePreferredInstall() + public function testMergePreferredInstall(): void { $config = new Config(false); $config->merge(array('config' => array('preferred-install' => 'dist'))); @@ -162,7 +162,7 @@ class ConfigTest extends TestCase $this->assertEquals(array('foo/*' => 'source', '*' => 'dist'), $config->get('preferred-install')); } - public function testMergeGithubOauth() + public function testMergeGithubOauth(): void { $config = new Config(false); $config->merge(array('config' => array('github-oauth' => array('foo' => 'bar')))); @@ -171,7 +171,7 @@ class ConfigTest extends TestCase $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz'), $config->get('github-oauth')); } - public function testVarReplacement() + public function testVarReplacement(): void { $config = new Config(false); $config->merge(array('config' => array('a' => 'b', 'c' => '{$a}'))); @@ -183,7 +183,7 @@ class ConfigTest extends TestCase $this->assertEquals($home.'/foo', $config->get('cache-dir')); } - public function testRealpathReplacement() + public function testRealpathReplacement(): void { $config = new Config(false, '/foo/bar'); $config->merge(array('config' => array( @@ -198,7 +198,7 @@ class ConfigTest extends TestCase $this->assertEquals('/baz', $config->get('cache-dir')); } - public function testStreamWrapperDirs() + public function testStreamWrapperDirs(): void { $config = new Config(false, '/foo/bar'); $config->merge(array('config' => array( @@ -208,7 +208,7 @@ class ConfigTest extends TestCase $this->assertEquals('s3://baz', $config->get('cache-dir')); } - public function testFetchingRelativePaths() + public function testFetchingRelativePaths(): void { $config = new Config(false, '/foo/bar'); $config->merge(array('config' => array( @@ -222,7 +222,7 @@ class ConfigTest extends TestCase $this->assertEquals('vendor/foo', $config->get('bin-dir', Config::RELATIVE_PATHS)); } - public function testOverrideGithubProtocols() + public function testOverrideGithubProtocols(): void { $config = new Config(false); $config->merge(array('config' => array('github-protocols' => array('https', 'ssh')))); @@ -231,7 +231,7 @@ class ConfigTest extends TestCase $this->assertEquals(array('https'), $config->get('github-protocols')); } - public function testGitDisabledByDefaultInGithubProtocols() + public function testGitDisabledByDefaultInGithubProtocols(): void { $config = new Config(false); $config->merge(array('config' => array('github-protocols' => array('https', 'git')))); @@ -247,7 +247,7 @@ class ConfigTest extends TestCase * * @param string $url */ - public function testAllowedUrlsPass($url) + public function testAllowedUrlsPass($url): void { $config = new Config(false); $config->prohibitUrlByConfig($url); @@ -258,7 +258,7 @@ class ConfigTest extends TestCase * * @param string $url */ - public function testProhibitedUrlsThrowException($url) + public function testProhibitedUrlsThrowException($url): void { self::expectException('Composer\Downloader\TransportException'); self::expectExceptionMessage('Your configuration does not allow connections to ' . $url); @@ -311,7 +311,7 @@ class ConfigTest extends TestCase /** * @group TLS */ - public function testDisableTlsCanBeOverridden() + public function testDisableTlsCanBeOverridden(): void { $config = new Config; $config->merge( @@ -324,7 +324,7 @@ class ConfigTest extends TestCase $this->assertTrue($config->get('disable-tls')); } - public function testProcessTimeout() + public function testProcessTimeout(): void { Platform::putEnv('COMPOSER_PROCESS_TIMEOUT', '0'); $config = new Config(true); @@ -334,7 +334,7 @@ class ConfigTest extends TestCase $this->assertEquals(0, $result); } - public function testHtaccessProtect() + public function testHtaccessProtect(): void { Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); $config = new Config(true); @@ -344,7 +344,7 @@ class ConfigTest extends TestCase $this->assertEquals(0, $result); } - public function testGetSourceOfValue() + public function testGetSourceOfValue(): void { Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT'); @@ -360,7 +360,7 @@ class ConfigTest extends TestCase $this->assertSame('phpunit-test', $config->getSourceOfValue('process-timeout')); } - public function testGetSourceOfValueEnvVariables() + public function testGetSourceOfValueEnvVariables(): void { Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); $config = new Config; diff --git a/tests/Composer/Test/Console/HtmlOutputFormatterTest.php b/tests/Composer/Test/Console/HtmlOutputFormatterTest.php index a105eec0d..60865f726 100644 --- a/tests/Composer/Test/Console/HtmlOutputFormatterTest.php +++ b/tests/Composer/Test/Console/HtmlOutputFormatterTest.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle; class HtmlOutputFormatterTest extends TestCase { - public function testFormatting() + public function testFormatting(): void { $formatter = new HtmlOutputFormatter(array( 'warning' => new OutputFormatterStyle('black', 'yellow'), diff --git a/tests/Composer/Test/DefaultConfigTest.php b/tests/Composer/Test/DefaultConfigTest.php index 2aeeb783e..0b5f694ea 100644 --- a/tests/Composer/Test/DefaultConfigTest.php +++ b/tests/Composer/Test/DefaultConfigTest.php @@ -19,7 +19,7 @@ class DefaultConfigTest extends TestCase /** * @group TLS */ - public function testDefaultValuesAreAsExpected() + public function testDefaultValuesAreAsExpected(): void { $config = new Config; $this->assertFalse($config->get('disable-tls')); diff --git a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php index 9703706d5..27569baee 100644 --- a/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php +++ b/tests/Composer/Test/DependencyResolver/DefaultPolicyTest.php @@ -41,7 +41,7 @@ class DefaultPolicyTest extends TestCase $this->policy = new DefaultPolicy; } - public function testSelectSingle() + public function testSelectSingle(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repositorySet->addRepository($this->repo); @@ -56,7 +56,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectNewest() + public function testSelectNewest(): void { $this->repo->addPackage($packageA1 = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageA2 = $this->getPackage('A', '2.0')); @@ -72,7 +72,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectNewestPicksLatest() + public function testSelectNewestPicksLatest(): void { $this->repo->addPackage($packageA1 = $this->getPackage('A', '1.0.0')); $this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.1-alpha')); @@ -88,7 +88,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectNewestPicksLatestStableWithPreferStable() + public function testSelectNewestPicksLatestStableWithPreferStable(): void { $this->repo->addPackage($packageA1 = $this->getPackage('A', '1.0.0')); $this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.1-alpha')); @@ -105,7 +105,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectNewestWithDevPicksNonDev() + public function testSelectNewestWithDevPicksNonDev(): void { $this->repo->addPackage($packageA1 = $this->getPackage('A', 'dev-foo')); $this->repo->addPackage($packageA2 = $this->getPackage('A', '1.0.0')); @@ -121,7 +121,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testRepositoryOrderingAffectsPriority() + public function testRepositoryOrderingAffectsPriority(): void { $repo1 = new ArrayRepository; $repo2 = new ArrayRepository; @@ -154,7 +154,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectLocalReposFirst() + public function testSelectLocalReposFirst(): void { $repoImportant = new ArrayRepository; @@ -185,7 +185,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectAllProviders() + public function testSelectAllProviders(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '2.0')); @@ -205,7 +205,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testPreferNonReplacingFromSameRepo() + public function testPreferNonReplacingFromSameRepo(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '2.0')); @@ -224,7 +224,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testPreferReplacingPackageFromSameVendor() + public function testPreferReplacingPackageFromSameVendor(): void { // test with default order $this->repo->addPackage($packageB = $this->getPackage('vendor-b/replacer', '1.0')); @@ -260,7 +260,7 @@ class DefaultPolicyTest extends TestCase $this->assertSame($expected, $selected); } - public function testSelectLowest() + public function testSelectLowest(): void { $policy = new DefaultPolicy(false, true); diff --git a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php index a3a911e46..3939fcdd2 100644 --- a/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolBuilderTest.php @@ -44,7 +44,7 @@ class PoolBuilderTest extends TestCase * @param mixed[] $packageRepos * @param mixed[] $fixed */ - public function testPoolBuilder($file, $message, $expect, $expectOptimized, $root, $requestData, $packageRepos, $fixed) + public function testPoolBuilder($file, $message, $expect, $expectOptimized, $root, $requestData, $packageRepos, $fixed): void { $rootAliases = !empty($root['aliases']) ? $root['aliases'] : array(); $minimumStability = !empty($root['minimum-stability']) ? $root['minimum-stability'] : 'stable'; diff --git a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php index 442b156ef..6b3e863bb 100644 --- a/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolOptimizerTest.php @@ -34,7 +34,7 @@ class PoolOptimizerTest extends TestCase * @param BasePackage[] $expectedPackages * @param string $message */ - public function testPoolOptimizer(array $requestData, array $packagesBefore, array $expectedPackages, $message) + public function testPoolOptimizer(array $requestData, array $packagesBefore, array $expectedPackages, $message): void { $lockedRepo = new LockArrayRepository(); diff --git a/tests/Composer/Test/DependencyResolver/PoolTest.php b/tests/Composer/Test/DependencyResolver/PoolTest.php index 350a5cab8..1e7fd5724 100644 --- a/tests/Composer/Test/DependencyResolver/PoolTest.php +++ b/tests/Composer/Test/DependencyResolver/PoolTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class PoolTest extends TestCase { - public function testPool() + public function testPool(): void { $package = $this->getPackage('foo', '1'); @@ -27,7 +27,7 @@ class PoolTest extends TestCase $this->assertEquals(array($package), $pool->whatProvides('foo')); } - public function testWhatProvidesPackageWithConstraint() + public function testWhatProvidesPackageWithConstraint(): void { $firstPackage = $this->getPackage('foo', '1'); $secondPackage = $this->getPackage('foo', '2'); @@ -41,7 +41,7 @@ class PoolTest extends TestCase $this->assertEquals(array($secondPackage), $pool->whatProvides('foo', $this->getVersionConstraint('==', '2'))); } - public function testPackageById() + public function testPackageById(): void { $package = $this->getPackage('foo', '1'); @@ -50,7 +50,7 @@ class PoolTest extends TestCase $this->assertSame($package, $pool->packageById(1)); } - public function testWhatProvidesWhenPackageCannotBeFound() + public function testWhatProvidesWhenPackageCannotBeFound(): void { $pool = $this->createPool(); diff --git a/tests/Composer/Test/DependencyResolver/RequestTest.php b/tests/Composer/Test/DependencyResolver/RequestTest.php index a93bc404b..c3fff4a0e 100644 --- a/tests/Composer/Test/DependencyResolver/RequestTest.php +++ b/tests/Composer/Test/DependencyResolver/RequestTest.php @@ -19,7 +19,7 @@ use Composer\Test\TestCase; class RequestTest extends TestCase { - public function testRequestInstall() + public function testRequestInstall(): void { $repo = new ArrayRepository; $foo = $this->getPackage('foo', '1'); @@ -41,7 +41,7 @@ class RequestTest extends TestCase ); } - public function testRequestInstallSamePackageFromDifferentRepositories() + public function testRequestInstallSamePackageFromDifferentRepositories(): void { $repo1 = new ArrayRepository; $repo2 = new ArrayRepository; diff --git a/tests/Composer/Test/DependencyResolver/RuleSetIteratorTest.php b/tests/Composer/Test/DependencyResolver/RuleSetIteratorTest.php index 3f2429024..807311882 100644 --- a/tests/Composer/Test/DependencyResolver/RuleSetIteratorTest.php +++ b/tests/Composer/Test/DependencyResolver/RuleSetIteratorTest.php @@ -43,7 +43,7 @@ class RuleSetIteratorTest extends TestCase ); } - public function testForeach() + public function testForeach(): void { $ruleSetIterator = new RuleSetIterator($this->rules); @@ -61,7 +61,7 @@ class RuleSetIteratorTest extends TestCase $this->assertEquals($expected, $result); } - public function testKeys() + public function testKeys(): void { $ruleSetIterator = new RuleSetIterator($this->rules); diff --git a/tests/Composer/Test/DependencyResolver/RuleSetTest.php b/tests/Composer/Test/DependencyResolver/RuleSetTest.php index f25e3df4f..c891cb936 100644 --- a/tests/Composer/Test/DependencyResolver/RuleSetTest.php +++ b/tests/Composer/Test/DependencyResolver/RuleSetTest.php @@ -22,7 +22,7 @@ use Composer\Test\TestCase; class RuleSetTest extends TestCase { - public function testAdd() + public function testAdd(): void { $rules = array( RuleSet::TYPE_PACKAGE => array(), @@ -44,7 +44,7 @@ class RuleSetTest extends TestCase $this->assertEquals($rules, $ruleSet->getRules()); } - public function testAddIgnoresDuplicates() + public function testAddIgnoresDuplicates(): void { $rules = array( RuleSet::TYPE_REQUEST => array( @@ -63,7 +63,7 @@ class RuleSetTest extends TestCase $this->assertCount(1, $ruleSet->getIteratorFor(array(RuleSet::TYPE_REQUEST))); } - public function testAddWhenTypeIsNotRecognized() + public function testAddWhenTypeIsNotRecognized(): void { $ruleSet = new RuleSet; @@ -72,7 +72,7 @@ class RuleSetTest extends TestCase $ruleSet->add(new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)), 7); } - public function testCount() + public function testCount(): void { $ruleSet = new RuleSet; @@ -82,7 +82,7 @@ class RuleSetTest extends TestCase $this->assertEquals(2, $ruleSet->count()); } - public function testRuleById() + public function testRuleById(): void { $ruleSet = new RuleSet; @@ -92,7 +92,7 @@ class RuleSetTest extends TestCase $this->assertSame($rule, $ruleSet->ruleById[0]); } - public function testGetIterator() + public function testGetIterator(): void { $ruleSet = new RuleSet; @@ -108,7 +108,7 @@ class RuleSetTest extends TestCase $this->assertSame($rule2, $iterator->current()); } - public function testGetIteratorFor() + public function testGetIteratorFor(): void { $ruleSet = new RuleSet; $rule1 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -122,7 +122,7 @@ class RuleSetTest extends TestCase $this->assertSame($rule2, $iterator->current()); } - public function testGetIteratorWithout() + public function testGetIteratorWithout(): void { $ruleSet = new RuleSet; $rule1 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -136,7 +136,7 @@ class RuleSetTest extends TestCase $this->assertSame($rule2, $iterator->current()); } - public function testPrettyString() + public function testPrettyString(): void { $pool = new Pool(array( $p = $this->getPackage('foo', '2.1'), diff --git a/tests/Composer/Test/DependencyResolver/RuleTest.php b/tests/Composer/Test/DependencyResolver/RuleTest.php index 18f57c685..ed1401936 100644 --- a/tests/Composer/Test/DependencyResolver/RuleTest.php +++ b/tests/Composer/Test/DependencyResolver/RuleTest.php @@ -22,7 +22,7 @@ use Composer\Test\TestCase; class RuleTest extends TestCase { - public function testGetHash() + public function testGetHash(): void { $rule = new GenericRule(array(123), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -30,7 +30,7 @@ class RuleTest extends TestCase $this->assertEquals($hash['hash'], $rule->getHash()); } - public function testEqualsForRulesWithDifferentHashes() + public function testEqualsForRulesWithDifferentHashes(): void { $rule = new GenericRule(array(1, 2), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule2 = new GenericRule(array(1, 3), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -38,7 +38,7 @@ class RuleTest extends TestCase $this->assertFalse($rule->equals($rule2)); } - public function testEqualsForRulesWithDifferLiteralsQuantity() + public function testEqualsForRulesWithDifferLiteralsQuantity(): void { $rule = new GenericRule(array(1, 12), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule2 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -46,7 +46,7 @@ class RuleTest extends TestCase $this->assertFalse($rule->equals($rule2)); } - public function testEqualsForRulesWithSameLiterals() + public function testEqualsForRulesWithSameLiterals(): void { $rule = new GenericRule(array(1, 12), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule2 = new GenericRule(array(1, 12), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -54,7 +54,7 @@ class RuleTest extends TestCase $this->assertTrue($rule->equals($rule2)); } - public function testSetAndGetType() + public function testSetAndGetType(): void { $rule = new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule->setType(RuleSet::TYPE_REQUEST); @@ -62,7 +62,7 @@ class RuleTest extends TestCase $this->assertEquals(RuleSet::TYPE_REQUEST, $rule->getType()); } - public function testEnable() + public function testEnable(): void { $rule = new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule->disable(); @@ -72,7 +72,7 @@ class RuleTest extends TestCase $this->assertFalse($rule->isDisabled()); } - public function testDisable() + public function testDisable(): void { $rule = new GenericRule(array(), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule->enable(); @@ -82,7 +82,7 @@ class RuleTest extends TestCase $this->assertFalse($rule->isEnabled()); } - public function testIsAssertions() + public function testIsAssertions(): void { $rule = new GenericRule(array(1, 12), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); $rule2 = new GenericRule(array(1), Rule::RULE_ROOT_REQUIRE, array('packageName' => '', 'constraint' => new MatchAllConstraint)); @@ -91,7 +91,7 @@ class RuleTest extends TestCase $this->assertTrue($rule2->isAssertion()); } - public function testPrettyString() + public function testPrettyString(): void { $pool = new Pool(array( $p1 = $this->getPackage('foo', '2.1'), diff --git a/tests/Composer/Test/DependencyResolver/SolverTest.php b/tests/Composer/Test/DependencyResolver/SolverTest.php index e6e51c2fb..f63e5167e 100644 --- a/tests/Composer/Test/DependencyResolver/SolverTest.php +++ b/tests/Composer/Test/DependencyResolver/SolverTest.php @@ -58,7 +58,7 @@ class SolverTest extends TestCase $this->policy = new DefaultPolicy; } - public function testSolverInstallSingle() + public function testSolverInstallSingle(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->reposComplete(); @@ -70,7 +70,7 @@ class SolverTest extends TestCase )); } - public function testSolverRemoveIfNotRequested() + public function testSolverRemoveIfNotRequested(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->reposComplete(); @@ -80,7 +80,7 @@ class SolverTest extends TestCase )); } - public function testInstallNonExistingPackageFails() + public function testInstallNonExistingPackageFails(): void { $this->repo->addPackage($this->getPackage('A', '1.0')); $this->reposComplete(); @@ -99,7 +99,7 @@ class SolverTest extends TestCase } } - public function testSolverInstallSamePackageFromDifferentRepositories() + public function testSolverInstallSamePackageFromDifferentRepositories(): void { $repo1 = new ArrayRepository; $repo2 = new ArrayRepository; @@ -117,7 +117,7 @@ class SolverTest extends TestCase )); } - public function testSolverInstallWithDeps() + public function testSolverInstallWithDeps(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -135,7 +135,7 @@ class SolverTest extends TestCase )); } - public function testSolverInstallHonoursNotEqualOperator() + public function testSolverInstallHonoursNotEqualOperator(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -161,7 +161,7 @@ class SolverTest extends TestCase )); } - public function testSolverInstallWithDepsInOrder() + public function testSolverInstallWithDepsInOrder(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -207,7 +207,7 @@ class SolverTest extends TestCase * * CAUTION: IF THIS TEST EVER FAILS, SOLVER BEHAVIOR HAS CHANGED AND MAY BREAK DOWNSTREAM USERS */ - public function testSolverMultiPackageNameVersionResolutionDependsOnRequireOrder() + public function testSolverMultiPackageNameVersionResolutionDependsOnRequireOrder(): void { $this->repo->addPackage($php74 = $this->getPackage('ourcustom/PHP', '7.4.23')); $this->repo->addPackage($php80 = $this->getPackage('ourcustom/PHP', '8.0.10')); @@ -256,7 +256,7 @@ class SolverTest extends TestCase * * CAUTION: IF THIS TEST EVER FAILS, SOLVER BEHAVIOR HAS CHANGED AND MAY BREAK DOWNSTREAM USERS */ - public function testSolverMultiPackageNameVersionResolutionIsIndependentOfRequireOrderIfOrderedDescendingByRequirement() + public function testSolverMultiPackageNameVersionResolutionIsIndependentOfRequireOrderIfOrderedDescendingByRequirement(): void { $this->repo->addPackage($php74 = $this->getPackage('ourcustom/PHP', '7.4')); $this->repo->addPackage($php80 = $this->getPackage('ourcustom/PHP', '8.0')); @@ -297,7 +297,7 @@ class SolverTest extends TestCase )); } - public function testSolverFixLocked() + public function testSolverFixLocked(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->reposComplete(); @@ -307,7 +307,7 @@ class SolverTest extends TestCase $this->checkSolverResult(array()); } - public function testSolverFixLockedWithAlternative() + public function testSolverFixLockedWithAlternative(): void { $this->repo->addPackage($this->getPackage('A', '1.0')); $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); @@ -318,7 +318,7 @@ class SolverTest extends TestCase $this->checkSolverResult(array()); } - public function testSolverUpdateDoesOnlyUpdate() + public function testSolverUpdateDoesOnlyUpdate(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repoLocked->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -335,7 +335,7 @@ class SolverTest extends TestCase )); } - public function testSolverUpdateSingle() + public function testSolverUpdateSingle(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($newPackageA = $this->getPackage('A', '1.1')); @@ -348,7 +348,7 @@ class SolverTest extends TestCase )); } - public function testSolverUpdateAll() + public function testSolverUpdateAll(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repoLocked->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -368,7 +368,7 @@ class SolverTest extends TestCase )); } - public function testSolverUpdateCurrent() + public function testSolverUpdateCurrent(): void { $this->repoLocked->addPackage($this->getPackage('A', '1.0')); $this->repo->addPackage($this->getPackage('A', '1.0')); @@ -379,7 +379,7 @@ class SolverTest extends TestCase $this->checkSolverResult(array()); } - public function testSolverUpdateOnlyUpdatesSelectedPackage() + public function testSolverUpdateOnlyUpdatesSelectedPackage(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repoLocked->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -396,7 +396,7 @@ class SolverTest extends TestCase )); } - public function testSolverUpdateConstrained() + public function testSolverUpdateConstrained(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($newPackageA = $this->getPackage('A', '1.2')); @@ -412,7 +412,7 @@ class SolverTest extends TestCase ))); } - public function testSolverUpdateFullyConstrained() + public function testSolverUpdateFullyConstrained(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($newPackageA = $this->getPackage('A', '1.2')); @@ -428,7 +428,7 @@ class SolverTest extends TestCase ))); } - public function testSolverUpdateFullyConstrainedPrunesInstalledPackages() + public function testSolverUpdateFullyConstrainedPrunesInstalledPackages(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repoLocked->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -451,7 +451,7 @@ class SolverTest extends TestCase )); } - public function testSolverAllJobs() + public function testSolverAllJobs(): void { $this->repoLocked->addPackage($packageD = $this->getPackage('D', '1.0')); $this->repoLocked->addPackage($oldPackageC = $this->getPackage('C', '1.0')); @@ -476,7 +476,7 @@ class SolverTest extends TestCase )); } - public function testSolverThreeAlternativeRequireAndConflict() + public function testSolverThreeAlternativeRequireAndConflict(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '2.0')); $this->repo->addPackage($middlePackageB = $this->getPackage('B', '1.0')); @@ -495,7 +495,7 @@ class SolverTest extends TestCase )); } - public function testSolverObsolete() + public function testSolverObsolete(): void { $this->repoLocked->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -511,7 +511,7 @@ class SolverTest extends TestCase )); } - public function testInstallOneOfTwoAlternatives() + public function testInstallOneOfTwoAlternatives(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('A', '1.0')); @@ -525,7 +525,7 @@ class SolverTest extends TestCase )); } - public function testInstallProvider() + public function testInstallProvider(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0')); @@ -542,7 +542,7 @@ class SolverTest extends TestCase $this->solver->solve($this->request); } - public function testSkipReplacerOfExistingPackage() + public function testSkipReplacerOfExistingPackage(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0')); @@ -560,7 +560,7 @@ class SolverTest extends TestCase )); } - public function testNoInstallReplacerOfMissingPackage() + public function testNoInstallReplacerOfMissingPackage(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0')); @@ -576,7 +576,7 @@ class SolverTest extends TestCase $this->solver->solve($this->request); } - public function testSkipReplacedPackageIfReplacerIsSelected() + public function testSkipReplacedPackageIfReplacerIsSelected(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageQ = $this->getPackage('Q', '1.0')); @@ -595,7 +595,7 @@ class SolverTest extends TestCase )); } - public function testPickOlderIfNewerConflicts() + public function testPickOlderIfNewerConflicts(): void { $this->repo->addPackage($packageX = $this->getPackage('X', '1.0')); $packageX->setRequires(array( @@ -633,7 +633,7 @@ class SolverTest extends TestCase )); } - public function testInstallCircularRequire() + public function testInstallCircularRequire(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB1 = $this->getPackage('B', '0.9')); @@ -651,7 +651,7 @@ class SolverTest extends TestCase )); } - public function testInstallAlternativeWithCircularRequire() + public function testInstallAlternativeWithCircularRequire(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -681,7 +681,7 @@ class SolverTest extends TestCase * If a replacer D replaces B and C with C not otherwise available, * D must be installed instead of the original B. */ - public function testUseReplacerIfNecessary() + public function testUseReplacerIfNecessary(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -714,7 +714,7 @@ class SolverTest extends TestCase )); } - public function testIssue265() + public function testIssue265(): void { $this->repo->addPackage($packageA1 = $this->getPackage('A', '2.0.999999-dev')); $this->repo->addPackage($packageA2 = $this->getPackage('A', '2.1-dev')); @@ -749,7 +749,7 @@ class SolverTest extends TestCase $this->solver->solve($this->request); } - public function testConflictResultEmpty() + public function testConflictResultEmpty(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -782,7 +782,7 @@ class SolverTest extends TestCase } } - public function testUnsatisfiableRequires() + public function testUnsatisfiableRequires(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -812,7 +812,7 @@ class SolverTest extends TestCase } } - public function testRequireMismatchException() + public function testRequireMismatchException(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -860,7 +860,7 @@ class SolverTest extends TestCase } } - public function testLearnLiteralsWithSortedRuleLiterals() + public function testLearnLiteralsWithSortedRuleLiterals(): void { $this->repo->addPackage($packageTwig2 = $this->getPackage('twig/twig', '2.0')); $this->repo->addPackage($packageTwig16 = $this->getPackage('twig/twig', '1.6')); @@ -887,7 +887,7 @@ class SolverTest extends TestCase )); } - public function testInstallRecursiveAliasDependencies() + public function testInstallRecursiveAliasDependencies(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '2.0')); @@ -913,7 +913,7 @@ class SolverTest extends TestCase )); } - public function testInstallDevAlias() + public function testInstallDevAlias(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '2.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -936,7 +936,7 @@ class SolverTest extends TestCase )); } - public function testInstallRootAliasesIfAliasOfIsInstalled() + public function testInstallRootAliasesIfAliasOfIsInstalled(): void { // root aliased, required $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); @@ -975,7 +975,7 @@ class SolverTest extends TestCase * In particular in this case the goal is to first have the solver decide X 2.0 should not be installed to later * decide to learn that X 2.0 must be installed and revert decisions to retry solving with this new assumption. */ - public function testLearnPositiveLiteral() + public function testLearnPositiveLiteral(): void { $this->repo->addPackage($packageA = $this->getPackage('A', '1.0')); $this->repo->addPackage($packageB = $this->getPackage('B', '1.0')); @@ -1042,7 +1042,7 @@ class SolverTest extends TestCase /** * @return void */ - protected function reposComplete() + protected function reposComplete(): void { $this->repoSet->addRepository($this->repo); $this->repoSet->addRepository($this->repoLocked); @@ -1051,7 +1051,7 @@ class SolverTest extends TestCase /** * @return void */ - protected function createSolver() + protected function createSolver(): void { $io = new NullIO(); $this->pool = $this->repoSet->createPool($this->request, $io); @@ -1062,7 +1062,7 @@ class SolverTest extends TestCase * @param array> $expected * @return void */ - protected function checkSolverResult(array $expected) + protected function checkSolverResult(array $expected): void { $this->createSolver(); $transaction = $this->solver->solve($this->request); diff --git a/tests/Composer/Test/DependencyResolver/TransactionTest.php b/tests/Composer/Test/DependencyResolver/TransactionTest.php index 4c19a6098..703fecf56 100644 --- a/tests/Composer/Test/DependencyResolver/TransactionTest.php +++ b/tests/Composer/Test/DependencyResolver/TransactionTest.php @@ -27,7 +27,7 @@ class TransactionTest extends TestCase { } - public function testTransactionGenerationAndSorting() + public function testTransactionGenerationAndSorting(): void { $presentPackages = array( $packageA = $this->getPackage('a/a', 'dev-master'), @@ -103,7 +103,7 @@ class TransactionTest extends TestCase * @param array> $expected * @return void */ - protected function checkTransactionOperations(Transaction $transaction, array $expected) + protected function checkTransactionOperations(Transaction $transaction, array $expected): void { $result = array(); foreach ($transaction->getOperations() as $operation) { diff --git a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php index 9537e462a..c12e1e6f4 100644 --- a/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ArchiveDownloaderTest.php @@ -19,7 +19,7 @@ class ArchiveDownloaderTest extends TestCase /** @var \Composer\Config&\PHPUnit\Framework\MockObject\MockObject */ protected $config; - public function testGetFileName() + public function testGetFileName(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -41,7 +41,7 @@ class ArchiveDownloaderTest extends TestCase $this->assertSame($first, $method->invoke($downloader, $packageMock, '/path')); } - public function testProcessUrl() + public function testProcessUrl(): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); @@ -57,7 +57,7 @@ class ArchiveDownloaderTest extends TestCase $this->assertEquals($expected, $url); } - public function testProcessUrl2() + public function testProcessUrl2(): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); @@ -73,7 +73,7 @@ class ArchiveDownloaderTest extends TestCase $this->assertEquals($expected, $url); } - public function testProcessUrl3() + public function testProcessUrl3(): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); @@ -93,7 +93,7 @@ class ArchiveDownloaderTest extends TestCase * @dataProvider provideUrls * @param string $url */ - public function testProcessUrlRewriteDist($url) + public function testProcessUrlRewriteDist($url): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); @@ -132,7 +132,7 @@ class ArchiveDownloaderTest extends TestCase * @param string $url * @param string $extension */ - public function testProcessUrlRewriteBitbucketDist($url, $extension) + public function testProcessUrlRewriteBitbucketDist($url, $extension): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); diff --git a/tests/Composer/Test/Downloader/DownloadManagerTest.php b/tests/Composer/Test/Downloader/DownloadManagerTest.php index 7c84a1c9b..dd7e38ba9 100644 --- a/tests/Composer/Test/Downloader/DownloadManagerTest.php +++ b/tests/Composer/Test/Downloader/DownloadManagerTest.php @@ -30,7 +30,7 @@ class DownloadManagerTest extends TestCase $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); } - public function testSetGetDownloader() + public function testSetGetDownloader(): void { $downloader = $this->createDownloaderMock(); $manager = new DownloadManager($this->io, false, $this->filesystem); @@ -42,7 +42,7 @@ class DownloadManagerTest extends TestCase $manager->getDownloader('unregistered'); } - public function testGetDownloaderForIncorrectlyInstalledPackage() + public function testGetDownloaderForIncorrectlyInstalledPackage(): void { $package = $this->createPackageMock(); $package @@ -57,7 +57,7 @@ class DownloadManagerTest extends TestCase $manager->getDownloaderForPackage($package); } - public function testGetDownloaderForCorrectlyInstalledDistPackage() + public function testGetDownloaderForCorrectlyInstalledDistPackage(): void { $package = $this->createPackageMock(); $package @@ -89,7 +89,7 @@ class DownloadManagerTest extends TestCase $this->assertSame($downloader, $manager->getDownloaderForPackage($package)); } - public function testGetDownloaderForIncorrectlyInstalledDistPackage() + public function testGetDownloaderForIncorrectlyInstalledDistPackage(): void { $package = $this->createPackageMock(); $package @@ -123,7 +123,7 @@ class DownloadManagerTest extends TestCase $manager->getDownloaderForPackage($package); } - public function testGetDownloaderForCorrectlyInstalledSourcePackage() + public function testGetDownloaderForCorrectlyInstalledSourcePackage(): void { $package = $this->createPackageMock(); $package @@ -155,7 +155,7 @@ class DownloadManagerTest extends TestCase $this->assertSame($downloader, $manager->getDownloaderForPackage($package)); } - public function testGetDownloaderForIncorrectlyInstalledSourcePackage() + public function testGetDownloaderForIncorrectlyInstalledSourcePackage(): void { $package = $this->createPackageMock(); $package @@ -189,7 +189,7 @@ class DownloadManagerTest extends TestCase $manager->getDownloaderForPackage($package); } - public function testGetDownloaderForMetapackage() + public function testGetDownloaderForMetapackage(): void { $package = $this->createPackageMock(); $package @@ -202,7 +202,7 @@ class DownloadManagerTest extends TestCase $this->assertNull($manager->getDownloaderForPackage($package)); } - public function testFullPackageDownload() + public function testFullPackageDownload(): void { $package = $this->createPackageMock(); $package @@ -238,7 +238,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testFullPackageDownloadFailover() + public function testFullPackageDownloadFailover(): void { $package = $this->createPackageMock(); $package @@ -291,7 +291,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testBadPackageDownload() + public function testBadPackageDownload(): void { $package = $this->createPackageMock(); $package @@ -309,7 +309,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testDistOnlyPackageDownload() + public function testDistOnlyPackageDownload(): void { $package = $this->createPackageMock(); $package @@ -345,7 +345,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testSourceOnlyPackageDownload() + public function testSourceOnlyPackageDownload(): void { $package = $this->createPackageMock(); $package @@ -381,7 +381,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testMetapackagePackageDownload() + public function testMetapackagePackageDownload(): void { $package = $this->createPackageMock(); $package @@ -411,7 +411,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testFullPackageDownloadWithSourcePreferred() + public function testFullPackageDownloadWithSourcePreferred(): void { $package = $this->createPackageMock(); $package @@ -448,7 +448,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testDistOnlyPackageDownloadWithSourcePreferred() + public function testDistOnlyPackageDownloadWithSourcePreferred(): void { $package = $this->createPackageMock(); $package @@ -485,7 +485,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testSourceOnlyPackageDownloadWithSourcePreferred() + public function testSourceOnlyPackageDownloadWithSourcePreferred(): void { $package = $this->createPackageMock(); $package @@ -522,7 +522,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testBadPackageDownloadWithSourcePreferred() + public function testBadPackageDownloadWithSourcePreferred(): void { $package = $this->createPackageMock(); $package @@ -541,7 +541,7 @@ class DownloadManagerTest extends TestCase $manager->download($package, 'target_dir'); } - public function testUpdateDistWithEqualTypes() + public function testUpdateDistWithEqualTypes(): void { $initial = $this->createPackageMock(); $initial @@ -579,7 +579,7 @@ class DownloadManagerTest extends TestCase $manager->update($initial, $target, 'vendor/bundles/FOS/UserBundle'); } - public function testUpdateDistWithNotEqualTypes() + public function testUpdateDistWithNotEqualTypes(): void { $initial = $this->createPackageMock(); $initial @@ -636,7 +636,7 @@ class DownloadManagerTest extends TestCase * @param bool $targetIsDev * @param string[] $expected */ - public function testGetAvailableSourcesUpdateSticksToSameSource($prevPkgSource, $prevPkgIsDev, $targetAvailable, $targetIsDev, $expected) + public function testGetAvailableSourcesUpdateSticksToSameSource($prevPkgSource, $prevPkgIsDev, $targetAvailable, $targetIsDev, $expected): void { $initial = null; if ($prevPkgSource) { @@ -689,7 +689,7 @@ class DownloadManagerTest extends TestCase ); } - public function testUpdateMetapackage() + public function testUpdateMetapackage(): void { $initial = $this->createPackageMock(); $target = $this->createPackageMock(); @@ -707,7 +707,7 @@ class DownloadManagerTest extends TestCase $manager->update($initial, $target, 'vendor/pkg'); } - public function testRemove() + public function testRemove(): void { $package = $this->createPackageMock(); @@ -730,7 +730,7 @@ class DownloadManagerTest extends TestCase $manager->remove($package, 'vendor/bundles/FOS/UserBundle'); } - public function testMetapackageRemove() + public function testMetapackageRemove(): void { $package = $this->createPackageMock(); @@ -750,7 +750,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithoutPreferenceDev() + public function testInstallPreferenceWithoutPreferenceDev(): void { $package = $this->createPackageMock(); $package @@ -793,7 +793,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithoutPreferenceNoDev() + public function testInstallPreferenceWithoutPreferenceNoDev(): void { $package = $this->createPackageMock(); $package @@ -836,7 +836,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithoutMatchDev() + public function testInstallPreferenceWithoutMatchDev(): void { $package = $this->createPackageMock(); $package @@ -883,7 +883,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithoutMatchNoDev() + public function testInstallPreferenceWithoutMatchNoDev(): void { $package = $this->createPackageMock(); $package @@ -930,7 +930,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithMatchAutoDev() + public function testInstallPreferenceWithMatchAutoDev(): void { $package = $this->createPackageMock(); $package @@ -977,7 +977,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithMatchAutoNoDev() + public function testInstallPreferenceWithMatchAutoNoDev(): void { $package = $this->createPackageMock(); $package @@ -1024,7 +1024,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithMatchSource() + public function testInstallPreferenceWithMatchSource(): void { $package = $this->createPackageMock(); $package @@ -1067,7 +1067,7 @@ class DownloadManagerTest extends TestCase /** * @covers Composer\Downloader\DownloadManager::resolvePackageInstallPreference */ - public function testInstallPreferenceWithMatchDist() + public function testInstallPreferenceWithMatchDist(): void { $package = $this->createPackageMock(); $package diff --git a/tests/Composer/Test/Downloader/FileDownloaderTest.php b/tests/Composer/Test/Downloader/FileDownloaderTest.php index 2ade50ce3..691a38a72 100644 --- a/tests/Composer/Test/Downloader/FileDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FileDownloaderTest.php @@ -57,7 +57,7 @@ class FileDownloaderTest extends TestCase return new FileDownloader($io, $this->config, $httpDownloader, $eventDispatcher, $cache, $filesystem); } - public function testDownloadForPackageWithoutDistReference() + public function testDownloadForPackageWithoutDistReference(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->once()) @@ -71,7 +71,7 @@ class FileDownloaderTest extends TestCase $downloader->download($packageMock, '/path'); } - public function testDownloadToExistingFile() + public function testDownloadToExistingFile(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -101,7 +101,7 @@ class FileDownloaderTest extends TestCase } } - public function testGetFileName() + public function testGetFileName(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->once()) @@ -121,7 +121,7 @@ class FileDownloaderTest extends TestCase $this->assertMatchesRegularExpression('#/vendor/composer/tmp-[a-z0-9]+\.js#', $method->invoke($downloader, $packageMock, '/path')); } - public function testDownloadButFileIsUnsaved() + public function testDownloadButFileIsUnsaved(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -176,7 +176,7 @@ class FileDownloaderTest extends TestCase } } - public function testDownloadWithCustomProcessedUrl() + public function testDownloadWithCustomProcessedUrl(): void { $path = $this->getUniqueTmpDirectory(); @@ -218,7 +218,7 @@ class FileDownloaderTest extends TestCase $this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $this->getProcessExecutorMock() ); - $dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($expectedUrl) { + $dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($expectedUrl): void { $event->setProcessedUrl($expectedUrl); }); @@ -275,7 +275,7 @@ class FileDownloaderTest extends TestCase } } - public function testDownloadWithCustomCacheKey() + public function testDownloadWithCustomCacheKey(): void { $path = $this->getUniqueTmpDirectory(); @@ -318,7 +318,7 @@ class FileDownloaderTest extends TestCase $this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $this->getProcessExecutorMock() ); - $dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($customCacheKey) { + $dispatcher->addListener(PluginEvents::PRE_FILE_DOWNLOAD, function (PreFileDownloadEvent $event) use ($customCacheKey): void { $event->setCustomCacheKey($customCacheKey); }); @@ -375,7 +375,7 @@ class FileDownloaderTest extends TestCase } } - public function testCacheGarbageCollectionIsCalled() + public function testCacheGarbageCollectionIsCalled(): void { $expectedTtl = '99999999'; @@ -403,7 +403,7 @@ class FileDownloaderTest extends TestCase $downloader = $this->getDownloader(null, $this->config, null, $cacheMock, null, null); } - public function testDownloadFileWithInvalidChecksum() + public function testDownloadFileWithInvalidChecksum(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -458,7 +458,7 @@ class FileDownloaderTest extends TestCase } } - public function testDowngradeShowsAppropriateMessage() + public function testDowngradeShowsAppropriateMessage(): void { $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $oldPackage->expects($this->once()) diff --git a/tests/Composer/Test/Downloader/FossilDownloaderTest.php b/tests/Composer/Test/Downloader/FossilDownloaderTest.php index 7a5e84e61..a59ee038c 100644 --- a/tests/Composer/Test/Downloader/FossilDownloaderTest.php +++ b/tests/Composer/Test/Downloader/FossilDownloaderTest.php @@ -52,7 +52,7 @@ class FossilDownloaderTest extends TestCase return new FossilDownloader($io, $config, $executor, $filesystem); } - public function testInstallForPackageWithoutSourceReference() + public function testInstallForPackageWithoutSourceReference(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->once()) @@ -65,7 +65,7 @@ class FossilDownloaderTest extends TestCase $downloader->install($packageMock, '/path'); } - public function testInstall() + public function testInstall(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -86,7 +86,7 @@ class FossilDownloaderTest extends TestCase $downloader->install($packageMock, 'repo'); } - public function testUpdateforPackageWithoutSourceReference() + public function testUpdateforPackageWithoutSourceReference(): void { $initialPackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); @@ -102,7 +102,7 @@ class FossilDownloaderTest extends TestCase $downloader->cleanup('update', $sourcePackageMock, '/path', $initialPackageMock); } - public function testUpdate() + public function testUpdate(): void { // Ensure file exists $file = $this->workingDir . '/.fslckout'; @@ -134,7 +134,7 @@ class FossilDownloaderTest extends TestCase $downloader->cleanup('update', $packageMock, $this->workingDir, $packageMock); } - public function testRemove() + public function testRemove(): void { // Ensure file exists $file = $this->workingDir . '/.fslckout'; @@ -159,7 +159,7 @@ class FossilDownloaderTest extends TestCase $downloader->cleanup('uninstall', $packageMock, $this->workingDir); } - public function testGetInstallationSource() + public function testGetInstallationSource(): void { $downloader = $this->getDownloaderMock(null); diff --git a/tests/Composer/Test/Downloader/GitDownloaderTest.php b/tests/Composer/Test/Downloader/GitDownloaderTest.php index 9791fd1ee..57d55da1b 100644 --- a/tests/Composer/Test/Downloader/GitDownloaderTest.php +++ b/tests/Composer/Test/Downloader/GitDownloaderTest.php @@ -50,7 +50,7 @@ class GitDownloaderTest extends TestCase * @param string|bool $version * @return void */ - private function initGitVersion($version) + private function initGitVersion($version): void { // reset the static version cache $refl = new \ReflectionProperty('Composer\Util\Git', 'version'); @@ -92,7 +92,7 @@ class GitDownloaderTest extends TestCase return new GitDownloader($io, $config, $executor, $filesystem); } - public function testDownloadForPackageWithoutSourceReference() + public function testDownloadForPackageWithoutSourceReference(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->once()) @@ -108,7 +108,7 @@ class GitDownloaderTest extends TestCase $downloader->cleanup('install', $packageMock, '/path'); } - public function testDownload() + public function testDownload(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -138,7 +138,7 @@ class GitDownloaderTest extends TestCase $downloader->cleanup('install', $packageMock, 'composerPath'); } - public function testDownloadWithCache() + public function testDownloadWithCache(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -165,7 +165,7 @@ class GitDownloaderTest extends TestCase $process = $this->getProcessExecutorMock(); $process->expects(array( - array('cmd' => $this->winCompat(sprintf("git clone --mirror -- 'https://example.com/composer/composer' '%s'", $cachePath)), 'callback' => function () use ($cachePath) { + array('cmd' => $this->winCompat(sprintf("git clone --mirror -- 'https://example.com/composer/composer' '%s'", $cachePath)), 'callback' => function () use ($cachePath): void { @mkdir($cachePath, 0777, true); }), array('cmd' => 'git rev-parse --git-dir', 'stdout' => '.'), @@ -183,7 +183,7 @@ class GitDownloaderTest extends TestCase @rmdir($cachePath); } - public function testDownloadUsesVariousProtocolsAndSetsPushUrlForGithub() + public function testDownloadUsesVariousProtocolsAndSetsPushUrlForGithub(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -238,7 +238,7 @@ class GitDownloaderTest extends TestCase * @param string $url * @param string $pushUrl */ - public function testDownloadAndSetPushUrlUseCustomVariousProtocolsForGithub($protocols, $url, $pushUrl) + public function testDownloadAndSetPushUrlUseCustomVariousProtocolsForGithub($protocols, $url, $pushUrl): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -272,7 +272,7 @@ class GitDownloaderTest extends TestCase $downloader->cleanup('install', $packageMock, 'composerPath'); } - public function testDownloadThrowsRuntimeExceptionIfGitCommandFails() + public function testDownloadThrowsRuntimeExceptionIfGitCommandFails(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -313,7 +313,7 @@ class GitDownloaderTest extends TestCase } } - public function testUpdateforPackageWithoutSourceReference() + public function testUpdateforPackageWithoutSourceReference(): void { $initialPackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); @@ -330,7 +330,7 @@ class GitDownloaderTest extends TestCase $downloader->cleanup('update', $sourcePackageMock, '/path', $initialPackageMock); } - public function testUpdate() + public function testUpdate(): void { $expectedGitUpdateCommand = $this->winCompat("(git remote set-url composer -- 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- 'https://github.com/composer/composer'"); @@ -367,7 +367,7 @@ class GitDownloaderTest extends TestCase $downloader->cleanup('update', $packageMock, $this->workingDir, $packageMock); } - public function testUpdateWithNewRepoUrl() + public function testUpdateWithNewRepoUrl(): void { $expectedGitUpdateCommand = $this->winCompat("(git remote set-url composer -- 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- 'https://github.com/composer/composer'"); @@ -419,7 +419,7 @@ composer https://github.com/old/url (push) /** * @group failing */ - public function testUpdateThrowsRuntimeExceptionIfGitCommandFails() + public function testUpdateThrowsRuntimeExceptionIfGitCommandFails(): void { $expectedGitUpdateCommand = $this->winCompat("(git remote set-url composer -- 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- 'https://github.com/composer/composer'"); $expectedGitUpdateCommand2 = $this->winCompat("(git remote set-url composer -- 'git@github.com:composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- 'git@github.com:composer/composer'"); @@ -470,7 +470,7 @@ composer https://github.com/old/url (push) } } - public function testUpdateDoesntThrowsRuntimeExceptionIfGitCommandFailsAtFirstButIsAbleToRecover() + public function testUpdateDoesntThrowsRuntimeExceptionIfGitCommandFailsAtFirstButIsAbleToRecover(): void { $expectedFirstGitUpdateCommand = $this->winCompat("(git remote set-url composer -- '".(Platform::isWindows() ? 'C:\\' : '/')."' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- '".(Platform::isWindows() ? 'C:\\' : '/')."'"); $expectedSecondGitUpdateCommand = $this->winCompat("(git remote set-url composer -- 'https://github.com/composer/composer' && git rev-parse --quiet --verify 'ref^{commit}' || (git fetch composer && git fetch --tags composer)) && git remote set-url composer -- 'https://github.com/composer/composer'"); @@ -517,7 +517,7 @@ composer https://github.com/old/url (push) $downloader->cleanup('update', $packageMock, $this->workingDir, $packageMock); } - public function testDowngradeShowsAppropriateMessage() + public function testDowngradeShowsAppropriateMessage(): void { $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $oldPackage->expects($this->any()) @@ -567,7 +567,7 @@ composer https://github.com/old/url (push) $downloader->cleanup('update', $newPackage, $this->workingDir, $oldPackage); } - public function testNotUsingDowngradingWithReferences() + public function testNotUsingDowngradingWithReferences(): void { $oldPackage = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $oldPackage->expects($this->any()) @@ -611,7 +611,7 @@ composer https://github.com/old/url (push) $downloader->cleanup('update', $newPackage, $this->workingDir, $oldPackage); } - public function testRemove() + public function testRemove(): void { $expectedGitResetCommand = $this->winCompat("git status --porcelain --untracked-files=no"); @@ -636,7 +636,7 @@ composer https://github.com/old/url (push) $downloader->cleanup('uninstall', $packageMock, $this->workingDir); } - public function testGetInstallationSource() + public function testGetInstallationSource(): void { $downloader = $this->getDownloaderMock(); diff --git a/tests/Composer/Test/Downloader/HgDownloaderTest.php b/tests/Composer/Test/Downloader/HgDownloaderTest.php index b2e555bab..f3a839303 100644 --- a/tests/Composer/Test/Downloader/HgDownloaderTest.php +++ b/tests/Composer/Test/Downloader/HgDownloaderTest.php @@ -52,7 +52,7 @@ class HgDownloaderTest extends TestCase return new HgDownloader($io, $config, $executor, $filesystem); } - public function testDownloadForPackageWithoutSourceReference() + public function testDownloadForPackageWithoutSourceReference(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->once()) @@ -65,7 +65,7 @@ class HgDownloaderTest extends TestCase $downloader->install($packageMock, '/path'); } - public function testDownload() + public function testDownload(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) @@ -85,7 +85,7 @@ class HgDownloaderTest extends TestCase $downloader->install($packageMock, 'composerPath'); } - public function testUpdateforPackageWithoutSourceReference() + public function testUpdateforPackageWithoutSourceReference(): void { $initialPackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $sourcePackageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); @@ -101,7 +101,7 @@ class HgDownloaderTest extends TestCase $downloader->cleanup('update', $sourcePackageMock, '/path', $initialPackageMock); } - public function testUpdate() + public function testUpdate(): void { $fs = new Filesystem; $fs->ensureDirectoryExists($this->workingDir.'/.hg'); @@ -128,7 +128,7 @@ class HgDownloaderTest extends TestCase $downloader->cleanup('update', $packageMock, $this->workingDir, $packageMock); } - public function testRemove() + public function testRemove(): void { $fs = new Filesystem; $fs->ensureDirectoryExists($this->workingDir.'/.hg'); @@ -151,7 +151,7 @@ class HgDownloaderTest extends TestCase $downloader->cleanup('uninstall', $packageMock, $this->workingDir); } - public function testGetInstallationSource() + public function testGetInstallationSource(): void { $downloader = $this->getDownloaderMock(null); diff --git a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php index ebcc0b662..c6b99b5a6 100644 --- a/tests/Composer/Test/Downloader/PerforceDownloaderTest.php +++ b/tests/Composer/Test/Downloader/PerforceDownloaderTest.php @@ -112,12 +112,12 @@ class PerforceDownloaderTest extends TestCase /** * @doesNotPerformAssertions */ - public function testInitPerforceInstantiatesANewPerforceObject() + public function testInitPerforceInstantiatesANewPerforceObject(): void { $this->downloader->initPerforce($this->package, $this->testPath, 'SOURCE_REF'); } - public function testInitPerforceDoesNothingIfPerforceAlreadySet() + public function testInitPerforceDoesNothingIfPerforceAlreadySet(): void { $perforce = $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock(); $this->downloader->setPerforce($perforce); @@ -129,7 +129,7 @@ class PerforceDownloaderTest extends TestCase * @depends testInitPerforceInstantiatesANewPerforceObject * @depends testInitPerforceDoesNothingIfPerforceAlreadySet */ - public function testDoInstallWithTag() + public function testDoInstallWithTag(): void { //I really don't like this test but the logic of each Perforce method is tested in the Perforce class. Really I am just enforcing workflow. $ref = 'SOURCE_REF@123'; @@ -153,7 +153,7 @@ class PerforceDownloaderTest extends TestCase * @depends testInitPerforceInstantiatesANewPerforceObject * @depends testInitPerforceDoesNothingIfPerforceAlreadySet */ - public function testDoInstallWithNoTag() + public function testDoInstallWithNoTag(): void { $ref = 'SOURCE_REF'; $label = null; diff --git a/tests/Composer/Test/Downloader/XzDownloaderTest.php b/tests/Composer/Test/Downloader/XzDownloaderTest.php index cae7bf299..1f2501d37 100644 --- a/tests/Composer/Test/Downloader/XzDownloaderTest.php +++ b/tests/Composer/Test/Downloader/XzDownloaderTest.php @@ -49,7 +49,7 @@ class XzDownloaderTest extends TestCase $this->fs->removeDirectory($this->testDir); } - public function testErrorMessages() + public function testErrorMessages(): void { $packageMock = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); $packageMock->expects($this->any()) diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index 8ecb2719f..92b9ab5e2 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -56,7 +56,7 @@ class ZipDownloaderTest extends TestCase * @param ?\Composer\Test\Downloader\MockedZipDownloader $obj * @return void */ - public function setPrivateProperty($name, $value, $obj = null) + public function setPrivateProperty($name, $value, $obj = null): void { $reflectionClass = new \ReflectionClass('Composer\Downloader\ZipDownloader'); $reflectedProperty = $reflectionClass->getProperty($name); @@ -68,7 +68,7 @@ class ZipDownloaderTest extends TestCase } } - public function testErrorMessages() + public function testErrorMessages(): void { if (!class_exists('ZipArchive')) { $this->markTestSkipped('zip extension missing'); @@ -106,7 +106,7 @@ class ZipDownloaderTest extends TestCase } } - public function testZipArchiveOnlyFailed() + public function testZipArchiveOnlyFailed(): void { self::expectException('RuntimeException'); self::expectExceptionMessage('There was an error extracting the ZIP file'); @@ -129,7 +129,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testZipArchiveExtractOnlyFailed() + public function testZipArchiveExtractOnlyFailed(): void { self::expectException('RuntimeException'); self::expectExceptionMessage('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): Not a directory'); @@ -152,7 +152,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testZipArchiveOnlyGood() + public function testZipArchiveOnlyGood(): void { if (!class_exists('ZipArchive')) { $this->markTestSkipped('zip extension missing'); @@ -173,7 +173,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testSystemUnzipOnlyFailed() + public function testSystemUnzipOnlyFailed(): void { self::expectException('Exception'); self::expectExceptionMessage('Failed to extract : (1) unzip'); @@ -202,7 +202,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testSystemUnzipOnlyGood() + public function testSystemUnzipOnlyGood(): void { $this->setPrivateProperty('isWindows', false); $this->setPrivateProperty('hasZipArchive', false); @@ -229,7 +229,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testNonWindowsFallbackGood() + public function testNonWindowsFallbackGood(): void { if (!class_exists('ZipArchive')) { $this->markTestSkipped('zip extension missing'); @@ -268,7 +268,7 @@ class ZipDownloaderTest extends TestCase $this->wait($promise); } - public function testNonWindowsFallbackFailed() + public function testNonWindowsFallbackFailed(): void { self::expectException('Exception'); self::expectExceptionMessage('There was an error extracting the ZIP file'); @@ -313,16 +313,16 @@ class ZipDownloaderTest extends TestCase * @param ?\React\Promise\PromiseInterface $promise * @return void */ - private function wait($promise) + private function wait($promise): void { if (null === $promise) { return; } $e = null; - $promise->then(function () { + $promise->then(function (): void { // noop - }, function ($ex) use (&$e) { + }, function ($ex) use (&$e): void { $e = $ex; }); diff --git a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php index 3217d8bf4..7a37a92c2 100644 --- a/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php +++ b/tests/Composer/Test/EventDispatcher/EventDispatcherTest.php @@ -28,7 +28,7 @@ use Symfony\Component\Console\Output\OutputInterface; class EventDispatcherTest extends TestCase { - public function testListenerExceptionsAreCaught() + public function testListenerExceptionsAreCaught(): void { self::expectException('RuntimeException'); @@ -56,7 +56,7 @@ class EventDispatcherTest extends TestCase * * @param string $command */ - public function testDispatcherCanExecuteSingleCommandLineScript($command) + public function testDispatcherCanExecuteSingleCommandLineScript($command): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -85,7 +85,7 @@ class EventDispatcherTest extends TestCase * * @param bool $devMode */ - public function testDispatcherPassDevModeToAutoloadGeneratorForScriptEvents($devMode) + public function testDispatcherPassDevModeToAutoloadGeneratorForScriptEvents($devMode): void { $composer = $this->createComposerInstance(); @@ -177,7 +177,7 @@ class EventDispatcherTest extends TestCase return $rm; } - public function testDispatcherRemoveListener() + public function testDispatcherRemoveListener(): void { $composer = $this->createComposerInstance(); @@ -220,7 +220,7 @@ class EventDispatcherTest extends TestCase $this->assertEquals($expected, $io->getOutput()); } - public function testDispatcherCanExecuteCliAndPhpInSameEventScriptStack() + public function testDispatcherCanExecuteCliAndPhpInSameEventScriptStack(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -257,7 +257,7 @@ class EventDispatcherTest extends TestCase $this->assertEquals($expected, $io->getOutput()); } - public function testDispatcherCanPutEnv() + public function testDispatcherCanPutEnv(): void { $dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') ->setConstructorArgs(array( @@ -286,7 +286,7 @@ class EventDispatcherTest extends TestCase $this->assertEquals($expected, $io->getOutput()); } - public function testDispatcherAppendsDirBinOnPathForEveryListener() + public function testDispatcherAppendsDirBinOnPathForEveryListener(): void { $currentDirectoryBkp = getcwd(); $composerBinDirBkp = Platform::getEnv('COMPOSER_BIN_DIR'); @@ -323,7 +323,7 @@ class EventDispatcherTest extends TestCase /** * @return void */ - public static function createsVendorBinFolderChecksEnvDoesNotContainsBin() + public static function createsVendorBinFolderChecksEnvDoesNotContainsBin(): void { mkdir(__DIR__ . '/vendor/bin', 0700, true); $val = getenv('PATH'); @@ -338,7 +338,7 @@ class EventDispatcherTest extends TestCase /** * @return void */ - public static function createsVendorBinFolderChecksEnvContainsBin() + public static function createsVendorBinFolderChecksEnvContainsBin(): void { $val = getenv('PATH'); @@ -352,7 +352,7 @@ class EventDispatcherTest extends TestCase /** * @return void */ - public static function getTestEnv() + public static function getTestEnv(): void { $val = getenv('ABC'); if ($val !== '123') { @@ -360,7 +360,7 @@ class EventDispatcherTest extends TestCase } } - public function testDispatcherCanExecuteComposerScriptGroups() + public function testDispatcherCanExecuteComposerScriptGroups(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -407,7 +407,7 @@ class EventDispatcherTest extends TestCase $this->assertEquals($expected, $io->getOutput()); } - public function testRecursionInScriptsNames() + public function testRecursionInScriptsNames(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -446,7 +446,7 @@ class EventDispatcherTest extends TestCase $this->assertEquals($expected, $io->getOutput()); } - public function testDispatcherDetectInfiniteRecursion() + public function testDispatcherDetectInfiniteRecursion(): void { self::expectException('RuntimeException'); @@ -509,7 +509,7 @@ class EventDispatcherTest extends TestCase ); } - public function testDispatcherOutputsCommand() + public function testDispatcherOutputsCommand(): void { $dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') ->setConstructorArgs(array( @@ -536,7 +536,7 @@ class EventDispatcherTest extends TestCase $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false); } - public function testDispatcherOutputsErrorOnFailedCommand() + public function testDispatcherOutputsErrorOnFailedCommand(): void { $dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') ->setConstructorArgs(array( @@ -572,7 +572,7 @@ class EventDispatcherTest extends TestCase $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false); } - public function testDispatcherInstallerEvents() + public function testDispatcherInstallerEvents(): void { $dispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher') ->setConstructorArgs(array( @@ -595,7 +595,7 @@ class EventDispatcherTest extends TestCase /** * @return void */ - public static function call() + public static function call(): void { throw new \RuntimeException(); } diff --git a/tests/Composer/Test/FactoryTest.php b/tests/Composer/Test/FactoryTest.php index 96b0e95d5..ec41827fb 100644 --- a/tests/Composer/Test/FactoryTest.php +++ b/tests/Composer/Test/FactoryTest.php @@ -19,7 +19,7 @@ class FactoryTest extends TestCase /** * @group TLS */ - public function testDefaultValuesAreAsExpected() + public function testDefaultValuesAreAsExpected(): void { $ioMock = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php index 8d97636a9..767b50747 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreAllPlatformRequirementFilterTest.php @@ -23,7 +23,7 @@ final class IgnoreAllPlatformRequirementFilterTest extends TestCase * @param string $req * @param bool $expectIgnored */ - public function testIsIgnored($req, $expectIgnored) + public function testIsIgnored($req, $expectIgnored): void { $platformRequirementFilter = new IgnoreAllPlatformRequirementFilter(); diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php index 3cf7469a4..685e97810 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreListPlatformRequirementFilterTest.php @@ -24,7 +24,7 @@ final class IgnoreListPlatformRequirementFilterTest extends TestCase * @param string $req * @param bool $expectIgnored */ - public function testIsIgnored(array $reqList, $req, $expectIgnored) + public function testIsIgnored(array $reqList, $req, $expectIgnored): void { $platformRequirementFilter = new IgnoreListPlatformRequirementFilter($reqList); diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php index 4698e94fa..02b7da85c 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/IgnoreNothingPlatformRequirementFilterTest.php @@ -22,7 +22,7 @@ final class IgnoreNothingPlatformRequirementFilterTest extends TestCase * * @param string $req */ - public function testIsIgnored($req) + public function testIsIgnored($req): void { $platformRequirementFilter = new IgnoreNothingPlatformRequirementFilter(); diff --git a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php index 44bcfce9e..c7e462b92 100644 --- a/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php +++ b/tests/Composer/Test/Filter/PlatformRequirementFilter/PlatformRequirementFilterFactoryTest.php @@ -23,7 +23,7 @@ final class PlatformRequirementFilterFactoryTest extends TestCase * @param mixed $boolOrList * @param class-string $expectedInstance */ - public function testFromBoolOrList($boolOrList, $expectedInstance) + public function testFromBoolOrList($boolOrList, $expectedInstance): void { $this->assertInstanceOf($expectedInstance, PlatformRequirementFilterFactory::fromBoolOrList($boolOrList)); } @@ -40,7 +40,7 @@ final class PlatformRequirementFilterFactoryTest extends TestCase ); } - public function testFromBoolThrowsExceptionIfTypeIsUnknown() + public function testFromBoolThrowsExceptionIfTypeIsUnknown(): void { self::expectException('InvalidArgumentException'); self::expectExceptionMessage('PlatformRequirementFilter: Unknown $boolOrList parameter NULL. Please report at https://github.com/composer/composer/issues/new.'); @@ -48,14 +48,14 @@ final class PlatformRequirementFilterFactoryTest extends TestCase PlatformRequirementFilterFactory::fromBoolOrList(null); } - public function testIgnoreAll() + public function testIgnoreAll(): void { $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreAll(); $this->assertInstanceOf('Composer\Filter\PlatformRequirementFilter\IgnoreAllPlatformRequirementFilter', $platformRequirementFilter); } - public function testIgnoreNothing() + public function testIgnoreNothing(): void { $platformRequirementFilter = PlatformRequirementFilterFactory::ignoreNothing(); diff --git a/tests/Composer/Test/IO/BufferIOTest.php b/tests/Composer/Test/IO/BufferIOTest.php index 52c11562a..8e86f1903 100644 --- a/tests/Composer/Test/IO/BufferIOTest.php +++ b/tests/Composer/Test/IO/BufferIOTest.php @@ -18,7 +18,7 @@ use Symfony\Component\Console\Input\StreamableInputInterface; class BufferIOTest extends TestCase { - public function testSetUserInputs() + public function testSetUserInputs(): void { $bufferIO = new BufferIO(); diff --git a/tests/Composer/Test/IO/ConsoleIOTest.php b/tests/Composer/Test/IO/ConsoleIOTest.php index e275274cc..0a46ab026 100644 --- a/tests/Composer/Test/IO/ConsoleIOTest.php +++ b/tests/Composer/Test/IO/ConsoleIOTest.php @@ -19,7 +19,7 @@ use Symfony\Component\Console\Output\OutputInterface; class ConsoleIOTest extends TestCase { - public function testIsInteractive() + public function testIsInteractive(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $inputMock->expects($this->exactly(2)) @@ -38,7 +38,7 @@ class ConsoleIOTest extends TestCase $this->assertFalse($consoleIO->isInteractive()); } - public function testWrite() + public function testWrite(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -54,7 +54,7 @@ class ConsoleIOTest extends TestCase $consoleIO->write('some information about something', false); } - public function testWriteError() + public function testWriteError(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\ConsoleOutputInterface')->getMock(); @@ -73,7 +73,7 @@ class ConsoleIOTest extends TestCase $consoleIO->writeError('some information about something', false); } - public function testWriteWithMultipleLineStringWhenDebugging() + public function testWriteWithMultipleLineStringWhenDebugging(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -101,7 +101,7 @@ class ConsoleIOTest extends TestCase $consoleIO->write($example, false); } - public function testOverwrite() + public function testOverwrite(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -129,7 +129,7 @@ class ConsoleIOTest extends TestCase $consoleIO->overwrite('something longer than initial (34)'); } - public function testAsk() + public function testAsk(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -157,7 +157,7 @@ class ConsoleIOTest extends TestCase $consoleIO->ask('Why?', 'default'); } - public function testAskConfirmation() + public function testAskConfirmation(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -185,7 +185,7 @@ class ConsoleIOTest extends TestCase $consoleIO->askConfirmation('Why?', false); } - public function testAskAndValidate() + public function testAskAndValidate(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -216,7 +216,7 @@ class ConsoleIOTest extends TestCase $consoleIO->askAndValidate('Why?', $validator, 10, 'default'); } - public function testSelect() + public function testSelect(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -245,7 +245,7 @@ class ConsoleIOTest extends TestCase $this->assertEquals(array('1'), $result); } - public function testSetAndgetAuthentication() + public function testSetAndgetAuthentication(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -260,7 +260,7 @@ class ConsoleIOTest extends TestCase ); } - public function testGetAuthenticationWhenDidNotSet() + public function testGetAuthenticationWhenDidNotSet(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); @@ -274,7 +274,7 @@ class ConsoleIOTest extends TestCase ); } - public function testHasAuthentication() + public function testHasAuthentication(): void { $inputMock = $this->getMockBuilder('Symfony\Component\Console\Input\InputInterface')->getMock(); $outputMock = $this->getMockBuilder('Symfony\Component\Console\Output\OutputInterface')->getMock(); diff --git a/tests/Composer/Test/IO/NullIOTest.php b/tests/Composer/Test/IO/NullIOTest.php index eecdc0aec..232e6c5d9 100644 --- a/tests/Composer/Test/IO/NullIOTest.php +++ b/tests/Composer/Test/IO/NullIOTest.php @@ -17,28 +17,28 @@ use Composer\Test\TestCase; class NullIOTest extends TestCase { - public function testIsInteractive() + public function testIsInteractive(): void { $io = new NullIO(); $this->assertFalse($io->isInteractive()); } - public function testhasAuthentication() + public function testhasAuthentication(): void { $io = new NullIO(); $this->assertFalse($io->hasAuthentication('foo')); } - public function testAskAndHideAnswer() + public function testAskAndHideAnswer(): void { $io = new NullIO(); $this->assertNull($io->askAndHideAnswer('foo')); } - public function testgetAuthentications() + public function testgetAuthentications(): void { $io = new NullIO(); @@ -47,21 +47,21 @@ class NullIOTest extends TestCase $this->assertEquals(array('username' => null, 'password' => null), $io->getAuthentication('foo')); } - public function testAsk() + public function testAsk(): void { $io = new NullIO(); $this->assertEquals('foo', $io->ask('bar', 'foo')); } - public function testAskConfirmation() + public function testAskConfirmation(): void { $io = new NullIO(); $this->assertEquals(false, $io->askConfirmation('bar', false)); } - public function testAskAndValidate() + public function testAskAndValidate(): void { $io = new NullIO(); @@ -70,7 +70,7 @@ class NullIOTest extends TestCase }, null, 'foo')); } - public function testSelect() + public function testSelect(): void { $io = new NullIO(); diff --git a/tests/Composer/Test/InstalledVersionsTest.php b/tests/Composer/Test/InstalledVersionsTest.php index 3865beb0e..d1aeaefcb 100644 --- a/tests/Composer/Test/InstalledVersionsTest.php +++ b/tests/Composer/Test/InstalledVersionsTest.php @@ -52,7 +52,7 @@ class InstalledVersionsTest extends TestCase InstalledVersions::reload(require __DIR__.'/Repository/Fixtures/installed.php'); } - public function testGetInstalledPackages() + public function testGetInstalledPackages(): void { $names = array( '__root__', @@ -74,7 +74,7 @@ class InstalledVersionsTest extends TestCase * @param string $name * @param bool $includeDevRequirements */ - public function testIsInstalled($expected, $name, $includeDevRequirements = true) + public function testIsInstalled($expected, $name, $includeDevRequirements = true): void { $this->assertSame($expected, InstalledVersions::isInstalled($name, $includeDevRequirements)); } @@ -99,7 +99,7 @@ class InstalledVersionsTest extends TestCase * @param string $name * @param string $constraint */ - public function testSatisfies($expected, $name, $constraint) + public function testSatisfies($expected, $name, $constraint): void { $this->assertSame($expected, InstalledVersions::satisfies(new VersionParser, $name, $constraint)); } @@ -139,7 +139,7 @@ class InstalledVersionsTest extends TestCase * @param string $expected * @param string $name */ - public function testGetVersionRanges($expected, $name) + public function testGetVersionRanges($expected, $name): void { $this->assertSame($expected, InstalledVersions::getVersionRanges($name)); } @@ -163,7 +163,7 @@ class InstalledVersionsTest extends TestCase * @param ?string $expected * @param string $name */ - public function testGetVersion($expected, $name) + public function testGetVersion($expected, $name): void { $this->assertSame($expected, InstalledVersions::getVersion($name)); } @@ -187,7 +187,7 @@ class InstalledVersionsTest extends TestCase * @param ?string $expected * @param string $name */ - public function testGetPrettyVersion($expected, $name) + public function testGetPrettyVersion($expected, $name): void { $this->assertSame($expected, InstalledVersions::getPrettyVersion($name)); } @@ -206,13 +206,13 @@ class InstalledVersionsTest extends TestCase ); } - public function testGetVersionOutOfBounds() + public function testGetVersionOutOfBounds(): void { self::expectException('OutOfBoundsException'); InstalledVersions::getVersion('not/installed'); } - public function testGetRootPackage() + public function testGetRootPackage(): void { $this->assertSame(array( 'pretty_version' => 'dev-master', @@ -231,7 +231,7 @@ class InstalledVersionsTest extends TestCase /** * @group legacy */ - public function testGetRawData() + public function testGetRawData(): void { $dir = $this->root; $this->assertSame(require __DIR__.'/Repository/Fixtures/installed.php', InstalledVersions::getRawData()); @@ -242,7 +242,7 @@ class InstalledVersionsTest extends TestCase * @param ?string $expected * @param string $name */ - public function testGetReference($expected, $name) + public function testGetReference($expected, $name): void { $this->assertSame($expected, InstalledVersions::getReference($name)); } @@ -261,7 +261,7 @@ class InstalledVersionsTest extends TestCase ); } - public function testGetInstalledPackagesByType() + public function testGetInstalledPackagesByType(): void { $names = array( '__root__', @@ -274,7 +274,7 @@ class InstalledVersionsTest extends TestCase $this->assertSame($names, \Composer\InstalledVersions::getInstalledPackagesByType('library')); } - public function testGetInstallPath() + public function testGetInstallPath(): void { $this->assertSame(realpath($this->root), realpath(\Composer\InstalledVersions::getInstallPath('__root__'))); $this->assertSame('/foo/bar/vendor/c/c', \Composer\InstalledVersions::getInstallPath('c/c')); diff --git a/tests/Composer/Test/Installer/BinaryInstallerTest.php b/tests/Composer/Test/Installer/BinaryInstallerTest.php index 5bb991f90..097b72d56 100644 --- a/tests/Composer/Test/Installer/BinaryInstallerTest.php +++ b/tests/Composer/Test/Installer/BinaryInstallerTest.php @@ -68,7 +68,7 @@ class BinaryInstallerTest extends TestCase * @dataProvider executableBinaryProvider * @param string $contents */ - public function testInstallAndExecBinaryWithFullCompat($contents) + public function testInstallAndExecBinaryWithFullCompat($contents): void { $package = $this->createPackageMock(); $package->expects($this->any()) diff --git a/tests/Composer/Test/Installer/InstallationManagerTest.php b/tests/Composer/Test/Installer/InstallationManagerTest.php index 4447919a3..e7acfd6c8 100644 --- a/tests/Composer/Test/Installer/InstallationManagerTest.php +++ b/tests/Composer/Test/Installer/InstallationManagerTest.php @@ -43,7 +43,7 @@ class InstallationManagerTest extends TestCase $this->io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); } - public function testAddGetInstaller() + public function testAddGetInstaller(): void { $installer = $this->createInstallerMock(); @@ -63,7 +63,7 @@ class InstallationManagerTest extends TestCase $manager->getInstaller('unregistered'); } - public function testAddRemoveInstaller() + public function testAddRemoveInstaller(): void { $installer = $this->createInstallerMock(); @@ -93,7 +93,7 @@ class InstallationManagerTest extends TestCase $this->assertSame($installer, $manager->getInstaller('vendor')); } - public function testExecute() + public function testExecute(): void { $manager = $this->getMockBuilder('Composer\Installer\InstallationManager') ->setConstructorArgs(array($this->loop, $this->io)) @@ -128,7 +128,7 @@ class InstallationManagerTest extends TestCase $manager->execute($this->repository, array($installOperation, $removeOperation, $updateOperation)); } - public function testInstall() + public function testInstall(): void { $installer = $this->createInstallerMock(); $manager = new InstallationManager($this->loop, $this->io); @@ -156,7 +156,7 @@ class InstallationManagerTest extends TestCase $manager->install($this->repository, $operation); } - public function testUpdateWithEqualTypes() + public function testUpdateWithEqualTypes(): void { $installer = $this->createInstallerMock(); $manager = new InstallationManager($this->loop, $this->io); @@ -189,7 +189,7 @@ class InstallationManagerTest extends TestCase $manager->update($this->repository, $operation); } - public function testUpdateWithNotEqualTypes() + public function testUpdateWithNotEqualTypes(): void { $libInstaller = $this->createInstallerMock(); $bundleInstaller = $this->createInstallerMock(); @@ -236,7 +236,7 @@ class InstallationManagerTest extends TestCase $manager->update($this->repository, $operation); } - public function testUninstall() + public function testUninstall(): void { $installer = $this->createInstallerMock(); $manager = new InstallationManager($this->loop, $this->io); @@ -264,7 +264,7 @@ class InstallationManagerTest extends TestCase $manager->uninstall($this->repository, $operation); } - public function testInstallBinary() + public function testInstallBinary(): void { $installer = $this->getMockBuilder('Composer\Installer\LibraryInstaller') ->disableOriginalConstructor() diff --git a/tests/Composer/Test/Installer/InstallerEventTest.php b/tests/Composer/Test/Installer/InstallerEventTest.php index 6c0689844..d2146f3a7 100644 --- a/tests/Composer/Test/Installer/InstallerEventTest.php +++ b/tests/Composer/Test/Installer/InstallerEventTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class InstallerEventTest extends TestCase { - public function testGetter() + public function testGetter(): void { $composer = $this->getMockBuilder('Composer\Composer')->getMock(); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); diff --git a/tests/Composer/Test/Installer/LibraryInstallerTest.php b/tests/Composer/Test/Installer/LibraryInstallerTest.php index a302c0b90..ad933dcaa 100644 --- a/tests/Composer/Test/Installer/LibraryInstallerTest.php +++ b/tests/Composer/Test/Installer/LibraryInstallerTest.php @@ -102,7 +102,7 @@ class LibraryInstallerTest extends TestCase $this->fs->removeDirectory($this->rootDir); } - public function testInstallerCreationShouldNotCreateVendorDirectory() + public function testInstallerCreationShouldNotCreateVendorDirectory(): void { $this->fs->removeDirectory($this->vendorDir); @@ -110,7 +110,7 @@ class LibraryInstallerTest extends TestCase $this->assertFileDoesNotExist($this->vendorDir); } - public function testInstallerCreationShouldNotCreateBinDirectory() + public function testInstallerCreationShouldNotCreateBinDirectory(): void { $this->fs->removeDirectory($this->binDir); @@ -118,7 +118,7 @@ class LibraryInstallerTest extends TestCase $this->assertFileDoesNotExist($this->binDir); } - public function testIsInstalled() + public function testIsInstalled(): void { $library = new LibraryInstaller($this->io, $this->composer); $package = $this->createPackageMock(); @@ -137,7 +137,7 @@ class LibraryInstallerTest extends TestCase * @depends testInstallerCreationShouldNotCreateVendorDirectory * @depends testInstallerCreationShouldNotCreateBinDirectory */ - public function testInstall() + public function testInstall(): void { $library = new LibraryInstaller($this->io, $this->composer); $package = $this->createPackageMock(); @@ -166,7 +166,7 @@ class LibraryInstallerTest extends TestCase * @depends testInstallerCreationShouldNotCreateVendorDirectory * @depends testInstallerCreationShouldNotCreateBinDirectory */ - public function testUpdate() + public function testUpdate(): void { $filesystem = $this->getMockBuilder('Composer\Util\Filesystem') ->getMock(); @@ -228,7 +228,7 @@ class LibraryInstallerTest extends TestCase $library->update($this->repository, $initial, $target); } - public function testUninstall() + public function testUninstall(): void { $library = new LibraryInstaller($this->io, $this->composer); $package = $this->createPackageMock(); @@ -265,7 +265,7 @@ class LibraryInstallerTest extends TestCase $library->uninstall($this->repository, $package); } - public function testGetInstallPath() + public function testGetInstallPath(): void { $library = new LibraryInstaller($this->io, $this->composer); $package = $this->createPackageMock(); @@ -278,7 +278,7 @@ class LibraryInstallerTest extends TestCase $this->assertEquals($this->vendorDir.'/'.$package->getName(), $library->getInstallPath($package)); } - public function testGetInstallPathWithTargetDir() + public function testGetInstallPathWithTargetDir(): void { $library = new LibraryInstaller($this->io, $this->composer); $package = $this->createPackageMock(); @@ -299,7 +299,7 @@ class LibraryInstallerTest extends TestCase * @depends testInstallerCreationShouldNotCreateVendorDirectory * @depends testInstallerCreationShouldNotCreateBinDirectory */ - public function testEnsureBinariesInstalled() + public function testEnsureBinariesInstalled(): void { $binaryInstallerMock = $this->getMockBuilder('Composer\Installer\BinaryInstaller') ->disableOriginalConstructor() diff --git a/tests/Composer/Test/Installer/MetapackageInstallerTest.php b/tests/Composer/Test/Installer/MetapackageInstallerTest.php index e66bf28d3..0b0b2035a 100644 --- a/tests/Composer/Test/Installer/MetapackageInstallerTest.php +++ b/tests/Composer/Test/Installer/MetapackageInstallerTest.php @@ -39,7 +39,7 @@ class MetapackageInstallerTest extends TestCase $this->installer = new MetapackageInstaller($this->io); } - public function testInstall() + public function testInstall(): void { $package = $this->createPackageMock(); @@ -51,7 +51,7 @@ class MetapackageInstallerTest extends TestCase $this->installer->install($this->repository, $package); } - public function testUpdate() + public function testUpdate(): void { $initial = $this->createPackageMock(); $initial->expects($this->once()) @@ -85,7 +85,7 @@ class MetapackageInstallerTest extends TestCase $this->installer->update($this->repository, $initial, $target); } - public function testUninstall() + public function testUninstall(): void { $package = $this->createPackageMock(); diff --git a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php index 47152ff90..fc83c7261 100644 --- a/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php +++ b/tests/Composer/Test/Installer/SuggestedPackagesReporterTest.php @@ -42,7 +42,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::__construct */ - public function testConstructor() + public function testConstructor(): void { $this->io->expects($this->once()) ->method('write'); @@ -54,7 +54,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::getPackages */ - public function testGetPackagesEmptyByDefault() + public function testGetPackagesEmptyByDefault(): void { $this->assertEmpty($this->suggestedPackagesReporter->getPackages()); } @@ -63,7 +63,7 @@ class SuggestedPackagesReporterTest extends TestCase * @covers ::getPackages * @covers ::addPackage */ - public function testGetPackages() + public function testGetPackages(): void { $suggestedPackage = $this->getSuggestedPackageArray(); $this->suggestedPackagesReporter->addPackage( @@ -83,7 +83,7 @@ class SuggestedPackagesReporterTest extends TestCase * * @covers ::addPackage */ - public function testAddPackageAppends() + public function testAddPackageAppends(): void { $suggestedPackageA = $this->getSuggestedPackageArray(); $suggestedPackageB = $this->getSuggestedPackageArray(); @@ -108,7 +108,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::addSuggestionsFromPackage */ - public function testAddSuggestionsFromPackage() + public function testAddSuggestionsFromPackage(): void { $package = $this->createPackageMock(); $package->expects($this->once()) @@ -139,7 +139,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutput() + public function testOutput(): void { $this->suggestedPackagesReporter->addPackage('a', 'b', 'c'); @@ -157,7 +157,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutputWithNoSuggestionReason() + public function testOutputWithNoSuggestionReason(): void { $this->suggestedPackagesReporter->addPackage('a', 'b', ''); @@ -175,7 +175,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutputIgnoresFormatting() + public function testOutputIgnoresFormatting(): void { $this->suggestedPackagesReporter->addPackage('source', 'target1', "\x1b[1;37;42m Like us\r\non Facebook \x1b[0m"); $this->suggestedPackagesReporter->addPackage('source', 'target2', "Like us on Facebook"); @@ -199,7 +199,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutputMultiplePackages() + public function testOutputMultiplePackages(): void { $this->suggestedPackagesReporter->addPackage('a', 'b', 'c'); $this->suggestedPackagesReporter->addPackage('source package', 'target', 'because reasons'); @@ -221,7 +221,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutputSkipInstalledPackages() + public function testOutputSkipInstalledPackages(): void { $repository = $this->getMockBuilder('Composer\Repository\InstalledRepository')->disableOriginalConstructor()->getMock(); $package1 = $this->getMockBuilder('Composer\Package\PackageInterface')->getMock(); @@ -259,7 +259,7 @@ class SuggestedPackagesReporterTest extends TestCase /** * @covers ::output */ - public function testOutputNotGettingInstalledPackagesWhenNoSuggestions() + public function testOutputNotGettingInstalledPackagesWhenNoSuggestions(): void { $repository = $this->getMockBuilder('Composer\Repository\InstalledRepository')->disableOriginalConstructor()->getMock(); $repository->expects($this->exactly(0)) diff --git a/tests/Composer/Test/InstallerTest.php b/tests/Composer/Test/InstallerTest.php index c0ea9b1af..959ec7a33 100644 --- a/tests/Composer/Test/InstallerTest.php +++ b/tests/Composer/Test/InstallerTest.php @@ -74,7 +74,7 @@ class InstallerTest extends TestCase * @param RepositoryInterface[] $repositories * @param mixed[] $options */ - public function testInstaller(RootPackageInterface $rootPackage, $repositories, array $options) + public function testInstaller(RootPackageInterface $rootPackage, $repositories, array $options): void { $io = new BufferIO('', OutputInterface::VERBOSITY_NORMAL, new OutputFormatter(false)); @@ -127,7 +127,7 @@ class InstallerTest extends TestCase })); $lockJsonMock->expects($this->any()) ->method('write') - ->will($this->returnCallback(function ($value, $options = 0) use (&$lockData) { + ->will($this->returnCallback(function ($value, $options = 0) use (&$lockData): void { $lockData = json_encode($value, JSON_PRETTY_PRINT); })); @@ -237,7 +237,7 @@ class InstallerTest extends TestCase * @param string $expect * @param int|class-string<\Throwable> $expectResult */ - public function testSlowIntegration($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult) + public function testSlowIntegration($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult): void { Platform::putEnv('COMPOSER_POOL_OPTIMIZER', '0'); @@ -260,7 +260,7 @@ class InstallerTest extends TestCase * @param string $expect * @param int|class-string<\Throwable> $expectResult */ - public function testIntegrationWithPoolOptimizer($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult) + public function testIntegrationWithPoolOptimizer($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult): void { Platform::putEnv('COMPOSER_POOL_OPTIMIZER', '1'); @@ -283,7 +283,7 @@ class InstallerTest extends TestCase * @param string $expect * @param int|class-string<\Throwable> $expectResult */ - public function testIntegrationWithRawPool($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult) + public function testIntegrationWithRawPool($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expectOutputOptimized, $expect, $expectResult): void { Platform::putEnv('COMPOSER_POOL_OPTIMIZER', '0'); @@ -305,7 +305,7 @@ class InstallerTest extends TestCase * @param int|class-string<\Throwable> $expectResult * @return void */ - private function doTestIntegration($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expect, $expectResult) + private function doTestIntegration($file, $message, $condition, $composerConfig, $lock, $installed, $run, $expectLock, $expectInstalled, $expectOutput, $expect, $expectResult): void { if ($condition) { eval('$res = '.$condition.';'); @@ -353,7 +353,7 @@ class InstallerTest extends TestCase })); $lockJsonMock->expects($this->any()) ->method('write') - ->will($this->returnCallback(function ($value, $options = 0) use (&$lockData) { + ->will($this->returnCallback(function ($value, $options = 0) use (&$lockData): void { $lockData = json_encode($value, JSON_PRETTY_PRINT); })); @@ -361,7 +361,7 @@ class InstallerTest extends TestCase $actualLock = array(); $lockJsonMock->expects($this->atLeastOnce()) ->method('write') - ->will($this->returnCallback(function ($hash, $options) use (&$actualLock) { + ->will($this->returnCallback(function ($hash, $options) use (&$actualLock): void { // need to do assertion outside of mock for nice phpunit output // so store value temporarily in reference for later assetion $actualLock = $hash; diff --git a/tests/Composer/Test/Json/ComposerSchemaTest.php b/tests/Composer/Test/Json/ComposerSchemaTest.php index e45da5df3..474523b46 100644 --- a/tests/Composer/Test/Json/ComposerSchemaTest.php +++ b/tests/Composer/Test/Json/ComposerSchemaTest.php @@ -20,7 +20,7 @@ use Composer\Test\TestCase; */ class ComposerSchemaTest extends TestCase { - public function testNamePattern() + public function testNamePattern(): void { $expectedError = array( array( @@ -37,13 +37,13 @@ class ComposerSchemaTest extends TestCase $this->assertEquals($expectedError, $this->check($json)); } - public function testOptionalAbandonedProperty() + public function testOptionalAbandonedProperty(): void { $json = '{"name": "vendor/package", "description": "description", "abandoned": true}'; $this->assertTrue($this->check($json)); } - public function testRequireTypes() + public function testRequireTypes(): void { $json = '{"name": "vendor/package", "description": "description", "require": {"a": ["b"]} }'; $this->assertEquals(array( @@ -51,7 +51,7 @@ class ComposerSchemaTest extends TestCase ), $this->check($json)); } - public function testMinimumStabilityValues() + public function testMinimumStabilityValues(): void { $expectedError = array( array( diff --git a/tests/Composer/Test/Json/JsonFileTest.php b/tests/Composer/Test/Json/JsonFileTest.php index b0242622f..131730c9d 100644 --- a/tests/Composer/Test/Json/JsonFileTest.php +++ b/tests/Composer/Test/Json/JsonFileTest.php @@ -19,7 +19,7 @@ use Composer\Test\TestCase; class JsonFileTest extends TestCase { - public function testParseErrorDetectExtraComma() + public function testParseErrorDetectExtraComma(): void { $json = '{ "foo": "bar", @@ -27,7 +27,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 2', $json); } - public function testParseErrorDetectExtraCommaInArray() + public function testParseErrorDetectExtraCommaInArray(): void { $json = '{ "foo": [ @@ -37,7 +37,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 3', $json); } - public function testParseErrorDetectUnescapedBackslash() + public function testParseErrorDetectUnescapedBackslash(): void { $json = '{ "fo\o": "bar" @@ -45,7 +45,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 1', $json); } - public function testParseErrorSkipsEscapedBackslash() + public function testParseErrorSkipsEscapedBackslash(): void { $json = '{ "fo\\\\o": "bar" @@ -54,7 +54,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 2', $json); } - public function testParseErrorDetectSingleQuotes() + public function testParseErrorDetectSingleQuotes(): void { if (defined('JSON_PARSER_NOTSTRICT') && version_compare(phpversion('json'), '1.3.9', '<')) { $this->markTestSkipped('jsonc issue, see https://github.com/remicollet/pecl-json-c/issues/23'); @@ -65,7 +65,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 1', $json); } - public function testParseErrorDetectMissingQuotes() + public function testParseErrorDetectMissingQuotes(): void { $json = '{ foo: "bar" @@ -73,7 +73,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 1', $json); } - public function testParseErrorDetectArrayAsHash() + public function testParseErrorDetectArrayAsHash(): void { $json = '{ "foo": ["bar": "baz"] @@ -81,7 +81,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 2', $json); } - public function testParseErrorDetectMissingComma() + public function testParseErrorDetectMissingComma(): void { $json = '{ "foo": "bar" @@ -90,14 +90,14 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 2', $json); } - public function testSchemaValidation() + public function testSchemaValidation(): void { $json = new JsonFile(__DIR__.'/Fixtures/composer.json'); $this->assertTrue($json->validateSchema()); $this->assertTrue($json->validateSchema(JsonFile::LAX_SCHEMA)); } - public function testSchemaValidationError() + public function testSchemaValidationError(): void { $file = $this->createTempFile(); file_put_contents($file, '{ "name": null }'); @@ -121,7 +121,7 @@ class JsonFileTest extends TestCase unlink($file); } - public function testSchemaValidationLaxAdditionalProperties() + public function testSchemaValidationLaxAdditionalProperties(): void { $file = $this->createTempFile(); file_put_contents($file, '{ "name": "vendor/package", "description": "generic description", "foo": "bar" }'); @@ -137,7 +137,7 @@ class JsonFileTest extends TestCase unlink($file); } - public function testSchemaValidationLaxRequired() + public function testSchemaValidationLaxRequired(): void { $file = $this->createTempFile(); $json = new JsonFile($file); @@ -207,7 +207,7 @@ class JsonFileTest extends TestCase unlink($file); } - public function testCustomSchemaValidationLax() + public function testCustomSchemaValidationLax(): void { $file = $this->createTempFile(); file_put_contents($file, '{ "custom": "property", "another custom": "property" }'); @@ -223,7 +223,7 @@ class JsonFileTest extends TestCase unlink($schema); } - public function testCustomSchemaValidationStrict() + public function testCustomSchemaValidationStrict(): void { $file = $this->createTempFile(); file_put_contents($file, '{ "custom": "property" }'); @@ -239,7 +239,7 @@ class JsonFileTest extends TestCase unlink($schema); } - public function testParseErrorDetectMissingCommaMultiline() + public function testParseErrorDetectMissingCommaMultiline(): void { $json = '{ "foo": "barbar" @@ -249,7 +249,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 2', $json); } - public function testParseErrorDetectMissingColon() + public function testParseErrorDetectMissingColon(): void { $json = '{ "foo": "bar", @@ -258,7 +258,7 @@ class JsonFileTest extends TestCase $this->expectParseException('Parse error on line 3', $json); } - public function testSimpleJsonString() + public function testSimpleJsonString(): void { $data = array('name' => 'composer/composer'); $json = '{ @@ -267,7 +267,7 @@ class JsonFileTest extends TestCase $this->assertJsonFormat($json, $data); } - public function testTrailingBackslash() + public function testTrailingBackslash(): void { $data = array('Metadata\\' => 'src/'); $json = '{ @@ -276,7 +276,7 @@ class JsonFileTest extends TestCase $this->assertJsonFormat($json, $data); } - public function testFormatEmptyArray() + public function testFormatEmptyArray(): void { $data = array('test' => array(), 'test2' => new \stdClass); $json = '{ @@ -286,7 +286,7 @@ class JsonFileTest extends TestCase $this->assertJsonFormat($json, $data); } - public function testEscape() + public function testEscape(): void { $data = array("Metadata\\\"" => 'src/'); $json = '{ @@ -296,7 +296,7 @@ class JsonFileTest extends TestCase $this->assertJsonFormat($json, $data); } - public function testUnicode() + public function testUnicode(): void { $data = array("Žluťoučký \" kůň" => "úpěl ďábelské ódy za €"); $json = '{ @@ -306,35 +306,35 @@ class JsonFileTest extends TestCase $this->assertJsonFormat($json, $data); } - public function testOnlyUnicode() + public function testOnlyUnicode(): void { $data = "\\/ƌ"; $this->assertJsonFormat('"\\\\\\/ƌ"', $data, JSON_UNESCAPED_UNICODE); } - public function testEscapedSlashes() + public function testEscapedSlashes(): void { $data = "\\/foo"; $this->assertJsonFormat('"\\\\\\/foo"', $data, 0); } - public function testEscapedBackslashes() + public function testEscapedBackslashes(): void { $data = "a\\b"; $this->assertJsonFormat('"a\\\\b"', $data, 0); } - public function testEscapedUnicode() + public function testEscapedUnicode(): void { $data = "ƌ"; $this->assertJsonFormat('"\\u018c"', $data, 0); } - public function testDoubleEscapedUnicode() + public function testDoubleEscapedUnicode(): void { $jsonFile = new JsonFile('composer.json'); $data = array("Zdjęcia","hjkjhl\\u0119kkjk"); @@ -351,7 +351,7 @@ class JsonFileTest extends TestCase * @param string $json * @return void */ - private function expectParseException($text, $json) + private function expectParseException($text, $json): void { try { $result = JsonFile::parseJson($json); @@ -367,7 +367,7 @@ class JsonFileTest extends TestCase * @param int|null $options * @return void */ - private function assertJsonFormat($json, $data, $options = null) + private function assertJsonFormat($json, $data, $options = null): void { $file = new JsonFile('composer.json'); diff --git a/tests/Composer/Test/Json/JsonFormatterTest.php b/tests/Composer/Test/Json/JsonFormatterTest.php index d2bd8e0d6..cd95c6fc9 100644 --- a/tests/Composer/Test/Json/JsonFormatterTest.php +++ b/tests/Composer/Test/Json/JsonFormatterTest.php @@ -21,7 +21,7 @@ class JsonFormatterTest extends TestCase * Test if \u0119 will get correctly formatted (unescaped) * https://github.com/composer/composer/issues/2613 */ - public function testUnicodeWithPrependedSlash() + public function testUnicodeWithPrependedSlash(): void { if (!extension_loaded('mbstring')) { $this->markTestSkipped('Test requires the mbstring extension'); @@ -37,7 +37,7 @@ class JsonFormatterTest extends TestCase * Surrogate pairs are intentionally skipped and not unescaped * https://github.com/composer/composer/issues/7510 */ - public function testUtf16SurrogatePair() + public function testUtf16SurrogatePair(): void { if (!extension_loaded('mbstring')) { $this->markTestSkipped('Test requires the mbstring extension'); diff --git a/tests/Composer/Test/Json/JsonManipulatorTest.php b/tests/Composer/Test/Json/JsonManipulatorTest.php index 00fd74bae..883eda862 100644 --- a/tests/Composer/Test/Json/JsonManipulatorTest.php +++ b/tests/Composer/Test/Json/JsonManipulatorTest.php @@ -25,7 +25,7 @@ class JsonManipulatorTest extends TestCase * @param string $constraint * @param string $expected */ - public function testAddLink($json, $type, $package, $constraint, $expected) + public function testAddLink($json, $type, $package, $constraint, $expected): void { $manipulator = new JsonManipulator($json); $this->assertTrue($manipulator->addLink($type, $package, $constraint)); @@ -1301,7 +1301,7 @@ class JsonManipulatorTest extends TestCase * @param bool $sortPackages * @param string $expected */ - public function testAddLinkAndSortPackages($json, $type, $package, $constraint, $sortPackages, $expected) + public function testAddLinkAndSortPackages($json, $type, $package, $constraint, $sortPackages, $expected): void { $manipulator = new JsonManipulator($json); $this->assertTrue($manipulator->addLink($type, $package, $constraint, $sortPackages)); @@ -1385,7 +1385,7 @@ class JsonManipulatorTest extends TestCase * @param string $expected * @param ?string $expectedContent */ - public function testRemoveSubNode($json, $name, $expected, $expectedContent = null) + public function testRemoveSubNode($json, $name, $expected, $expectedContent = null): void { $manipulator = new JsonManipulator($json); @@ -1686,7 +1686,7 @@ class JsonManipulatorTest extends TestCase ); } - public function testRemoveSubNodeFromRequire() + public function testRemoveSubNodeFromRequire(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -1736,7 +1736,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddSubNodeInRequire() + public function testAddSubNodeInRequire(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -1788,7 +1788,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddExtraWithPackage() + public function testAddExtraWithPackage(): void { //$this->markTestSkipped(); $manipulator = new JsonManipulator('{ @@ -1829,7 +1829,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigWithPackage() + public function testAddConfigWithPackage(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -1875,7 +1875,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddSuggestWithPackage() + public function testAddSuggestWithPackage(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -1915,7 +1915,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddRepositoryCanInitializeEmptyRepositories() + public function testAddRepositoryCanInitializeEmptyRepositories(): void { $manipulator = new JsonManipulator('{ "repositories": { @@ -1933,7 +1933,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddRepositoryCanInitializeFromScratch() + public function testAddRepositoryCanInitializeFromScratch(): void { $manipulator = new JsonManipulator("{ \t\"a\": \"b\" @@ -1951,7 +1951,7 @@ class JsonManipulatorTest extends TestCase ", $manipulator->getContents()); } - public function testAddRepositoryCanAppend() + public function testAddRepositoryCanAppend(): void { $manipulator = new JsonManipulator('{ "repositories": { @@ -1977,7 +1977,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddRepositoryCanPrepend() + public function testAddRepositoryCanPrepend(): void { $manipulator = new JsonManipulator('{ "repositories": { @@ -2003,7 +2003,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddRepositoryCanOverrideDeepRepos() + public function testAddRepositoryCanOverrideDeepRepos(): void { $manipulator = new JsonManipulator('{ "repositories": { @@ -2025,7 +2025,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingEscapes() + public function testAddConfigSettingEscapes(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2043,7 +2043,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingWorksFromScratch() + public function testAddConfigSettingWorksFromScratch(): void { $manipulator = new JsonManipulator('{ }'); @@ -2059,7 +2059,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanAdd() + public function testAddConfigSettingCanAdd(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2077,7 +2077,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanOverwrite() + public function testAddConfigSettingCanOverwrite(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2096,7 +2096,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanOverwriteNumbers() + public function testAddConfigSettingCanOverwriteNumbers(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2113,7 +2113,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanOverwriteArrays() + public function testAddConfigSettingCanOverwriteArrays(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2148,7 +2148,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanAddSubKeyInEmptyConfig() + public function testAddConfigSettingCanAddSubKeyInEmptyConfig(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2166,7 +2166,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanAddSubKeyInEmptyVal() + public function testAddConfigSettingCanAddSubKeyInEmptyVal(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2195,7 +2195,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddConfigSettingCanAddSubKeyInHash() + public function testAddConfigSettingCanAddSubKeyInHash(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2217,7 +2217,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddRootSettingDoesNotBreakDots() + public function testAddRootSettingDoesNotBreakDots(): void { $manipulator = new JsonManipulator('{ "github-oauth": { @@ -2235,7 +2235,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveConfigSettingCanRemoveSubKeyInHash() + public function testRemoveConfigSettingCanRemoveSubKeyInHash(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2257,7 +2257,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveConfigSettingCanRemoveSubKeyInHashWithSiblings() + public function testRemoveConfigSettingCanRemoveSubKeyInHashWithSiblings(): void { $manipulator = new JsonManipulator('{ "config": { @@ -2281,7 +2281,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddMainKey() + public function testAddMainKey(): void { $manipulator = new JsonManipulator('{ "foo": "bar" @@ -2295,7 +2295,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddMainKeyWithContentHavingDollarSignFollowedByDigit() + public function testAddMainKeyWithContentHavingDollarSignFollowedByDigit(): void { $manipulator = new JsonManipulator('{ "foo": "bar" @@ -2309,7 +2309,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testAddMainKeyWithContentHavingDollarSignFollowedByDigit2() + public function testAddMainKeyWithContentHavingDollarSignFollowedByDigit2(): void { $manipulator = new JsonManipulator('{}'); @@ -2320,7 +2320,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testUpdateMainKey() + public function testUpdateMainKey(): void { $manipulator = new JsonManipulator('{ "foo": "bar" @@ -2333,7 +2333,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testUpdateMainKey2() + public function testUpdateMainKey2(): void { $manipulator = new JsonManipulator('{ "a": { @@ -2357,7 +2357,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testUpdateMainKey3() + public function testUpdateMainKey3(): void { $manipulator = new JsonManipulator('{ "require": { @@ -2380,7 +2380,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testUpdateMainKeyWithContentHavingDollarSignFollowedByDigit() + public function testUpdateMainKeyWithContentHavingDollarSignFollowedByDigit(): void { $manipulator = new JsonManipulator('{ "foo": "bar" @@ -2393,7 +2393,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveMainKey() + public function testRemoveMainKey(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -2453,7 +2453,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveMainKeyIfEmpty() + public function testRemoveMainKeyIfEmpty(): void { $manipulator = new JsonManipulator('{ "repositories": [ @@ -2495,7 +2495,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveMainKeyRemovesKeyWhereValueIsNull() + public function testRemoveMainKeyRemovesKeyWhereValueIsNull(): void { $manipulator = new JsonManipulator(json_encode(array( 'foo' => 9000, @@ -2511,7 +2511,7 @@ class JsonManipulatorTest extends TestCase $this->assertJsonStringEqualsJsonString($expected, $manipulator->getContents()); } - public function testIndentDetection() + public function testIndentDetection(): void { $manipulator = new JsonManipulator('{ @@ -2533,7 +2533,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testRemoveMainKeyAtEndOfFile() + public function testRemoveMainKeyAtEndOfFile(): void { $manipulator = new JsonManipulator('{ "require": { @@ -2562,7 +2562,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testEscapedUnicodeDoesNotCauseBacktrackLimitErrorGithubIssue8131() + public function testEscapedUnicodeDoesNotCauseBacktrackLimitErrorGithubIssue8131(): void { $manipulator = new JsonManipulator('{ "description": "Some U\u00F1icode", @@ -2582,7 +2582,7 @@ class JsonManipulatorTest extends TestCase ', $manipulator->getContents()); } - public function testLargeFileDoesNotCauseBacktrackLimitErrorGithubIssue9595() + public function testLargeFileDoesNotCauseBacktrackLimitErrorGithubIssue9595(): void { $manipulator = new JsonManipulator('{ "name": "leoloso/pop", diff --git a/tests/Composer/Test/Json/JsonValidationExceptionTest.php b/tests/Composer/Test/Json/JsonValidationExceptionTest.php index 2212b26c2..f10109aeb 100644 --- a/tests/Composer/Test/Json/JsonValidationExceptionTest.php +++ b/tests/Composer/Test/Json/JsonValidationExceptionTest.php @@ -22,14 +22,14 @@ class JsonValidationExceptionTest extends TestCase * @param string|null $message * @param string[]|null $errors */ - public function testGetErrors($message, $errors) + public function testGetErrors($message, $errors): void { $object = new JsonValidationException($message, $errors); $this->assertEquals($message, $object->getMessage()); $this->assertEquals($errors, $object->getErrors()); } - public function testGetErrorsWhenNoErrorsProvided() + public function testGetErrorsWhenNoErrorsProvided(): void { $object = new JsonValidationException('test message'); $this->assertEquals(array(), $object->getErrors()); diff --git a/tests/Composer/Test/Mock/FactoryMock.php b/tests/Composer/Test/Mock/FactoryMock.php index 79b50e19d..ad2a14b9a 100644 --- a/tests/Composer/Test/Mock/FactoryMock.php +++ b/tests/Composer/Test/Mock/FactoryMock.php @@ -47,7 +47,7 @@ class FactoryMock extends Factory return new \Composer\Package\Loader\RootPackageLoader($rm, $config, $parser, new VersionGuesserMock(), $io); } - protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir, RootPackageInterface $rootPackage, ProcessExecutor $process = null) + protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir, RootPackageInterface $rootPackage, ProcessExecutor $process = null): void { $rm->setLocalRepository(new InstalledArrayRepository); } @@ -57,11 +57,11 @@ class FactoryMock extends Factory return new InstallationManagerMock(); } - protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io, ProcessExecutor $process = null) + protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io, ProcessExecutor $process = null): void { } - protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im) + protected function purgePackages(InstalledRepositoryInterface $repo, Installer\InstallationManager $im): void { } } diff --git a/tests/Composer/Test/Mock/InstallationManagerMock.php b/tests/Composer/Test/Mock/InstallationManagerMock.php index ed4b33996..95fe5ecd5 100644 --- a/tests/Composer/Test/Mock/InstallationManagerMock.php +++ b/tests/Composer/Test/Mock/InstallationManagerMock.php @@ -45,7 +45,7 @@ class InstallationManagerMock extends InstallationManager { } - public function execute(InstalledRepositoryInterface $repo, array $operations, $devMode = true, $runScripts = true) + public function execute(InstalledRepositoryInterface $repo, array $operations, $devMode = true, $runScripts = true): void { foreach ($operations as $operation) { $method = $operation->getOperationType(); @@ -103,7 +103,7 @@ class InstallationManagerMock extends InstallationManager return null; } - public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation) + public function markAliasInstalled(InstalledRepositoryInterface $repo, MarkAliasInstalledOperation $operation): void { $package = $operation->getPackage(); @@ -113,7 +113,7 @@ class InstallationManagerMock extends InstallationManager parent::markAliasInstalled($repo, $operation); } - public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation) + public function markAliasUninstalled(InstalledRepositoryInterface $repo, MarkAliasUninstalledOperation $operation): void { $this->uninstalled[] = $operation->getPackage(); $this->trace[] = strip_tags((string) $operation); @@ -145,7 +145,7 @@ class InstallationManagerMock extends InstallationManager return $this->uninstalled; } - public function notifyInstalls(IOInterface $io) + public function notifyInstalls(IOInterface $io): void { // noop } diff --git a/tests/Composer/Test/Mock/InstalledFilesystemRepositoryMock.php b/tests/Composer/Test/Mock/InstalledFilesystemRepositoryMock.php index 574cfbd83..101005cda 100644 --- a/tests/Composer/Test/Mock/InstalledFilesystemRepositoryMock.php +++ b/tests/Composer/Test/Mock/InstalledFilesystemRepositoryMock.php @@ -17,11 +17,11 @@ use Composer\Installer\InstallationManager; class InstalledFilesystemRepositoryMock extends InstalledFilesystemRepository { - public function reload() + public function reload(): void { } - public function write($devMode, InstallationManager $installationManager) + public function write($devMode, InstallationManager $installationManager): void { } } diff --git a/tests/Composer/Test/Mock/ProcessExecutorMock.php b/tests/Composer/Test/Mock/ProcessExecutorMock.php index 9228c1310..cf9733ee1 100644 --- a/tests/Composer/Test/Mock/ProcessExecutorMock.php +++ b/tests/Composer/Test/Mock/ProcessExecutorMock.php @@ -48,7 +48,7 @@ class ProcessExecutorMock extends ProcessExecutor * * @return void */ - public function expects(array $expectations, $strict = false, array $defaultHandler = array('return' => 0, 'stdout' => '', 'stderr' => '')) + public function expects(array $expectations, $strict = false, array $defaultHandler = array('return' => 0, 'stdout' => '', 'stderr' => '')): void { /** @var array{cmd: string|list, return?: int, stdout?: string, stderr?: string, callback?: callable} $default */ $default = array('cmd' => '', 'return' => 0, 'stdout' => '', 'stderr' => '', 'callback' => null); @@ -175,12 +175,12 @@ class ProcessExecutorMock extends ProcessExecutor public function executeAsync($command, $cwd = null) { - $resolver = function ($resolve, $reject) { + $resolver = function ($resolve, $reject): void { // TODO strictly speaking this should resolve with a mock Process instance here $resolve(); }; - $canceler = function () { + $canceler = function (): void { throw new \RuntimeException('Aborted process'); }; diff --git a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php index 883dd4278..384623879 100644 --- a/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchivableFilesFinderTest.php @@ -102,7 +102,7 @@ class ArchivableFilesFinderTest extends TestCase $fs->removeDirectory($this->sources); } - public function testManualExcludes() + public function testManualExcludes(): void { $excludes = array( 'prefixB.foo', @@ -154,7 +154,7 @@ class ArchivableFilesFinderTest extends TestCase )); } - public function testGitExcludes() + public function testGitExcludes(): void { $this->skipIfNotExecutable('git'); @@ -202,7 +202,7 @@ class ArchivableFilesFinderTest extends TestCase )); } - public function testSkipExcludes() + public function testSkipExcludes(): void { $excludes = array( 'prefixB.foo', @@ -303,7 +303,7 @@ class ArchivableFilesFinderTest extends TestCase * * @return void */ - protected function assertArchivableFiles($expectedFiles) + protected function assertArchivableFiles($expectedFiles): void { $actualFiles = $this->getArchivableFiles(); diff --git a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php index 9d1aff56e..af8166576 100644 --- a/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php +++ b/tests/Composer/Test/Package/Archiver/ArchiveManagerTest.php @@ -48,7 +48,7 @@ class ArchiveManagerTest extends ArchiverTest $this->targetDir = $this->testDir.'/composer_archiver_tests'; } - public function testUnknownFormat() + public function testUnknownFormat(): void { self::expectException('RuntimeException'); @@ -57,7 +57,7 @@ class ArchiveManagerTest extends ArchiverTest $this->manager->archive($package, '__unknown_format__', $this->targetDir); } - public function testArchiveTar() + public function testArchiveTar(): void { $this->skipIfNotExecutable('git'); @@ -76,7 +76,7 @@ class ArchiveManagerTest extends ArchiverTest unlink($target); } - public function testArchiveCustomFileName() + public function testArchiveCustomFileName(): void { $this->skipIfNotExecutable('git'); @@ -120,7 +120,7 @@ class ArchiveManagerTest extends ArchiverTest * * @return void */ - protected function setupGitRepo() + protected function setupGitRepo(): void { $currentWorkDir = getcwd(); chdir($this->testDir); diff --git a/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php b/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php index e8cae5853..3d058375b 100644 --- a/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php +++ b/tests/Composer/Test/Package/Archiver/GitExcludeFilterTest.php @@ -23,7 +23,7 @@ class GitExcludeFilterTest extends TestCase * @param string $ignore * @param mixed[] $expected */ - public function testPatternEscape($ignore, $expected) + public function testPatternEscape($ignore, $expected): void { $filter = new GitExcludeFilter('/'); diff --git a/tests/Composer/Test/Package/Archiver/PharArchiverTest.php b/tests/Composer/Test/Package/Archiver/PharArchiverTest.php index 82ed226f3..5c571316a 100644 --- a/tests/Composer/Test/Package/Archiver/PharArchiverTest.php +++ b/tests/Composer/Test/Package/Archiver/PharArchiverTest.php @@ -16,7 +16,7 @@ use Composer\Package\Archiver\PharArchiver; class PharArchiverTest extends ArchiverTest { - public function testTarArchive() + public function testTarArchive(): void { // Set up repository $this->setupDummyRepo(); @@ -31,7 +31,7 @@ class PharArchiverTest extends ArchiverTest $this->filesystem->removeDirectory(dirname($target)); } - public function testZipArchive() + public function testZipArchive(): void { // Set up repository $this->setupDummyRepo(); @@ -51,7 +51,7 @@ class PharArchiverTest extends ArchiverTest * * @return void */ - protected function setupDummyRepo() + protected function setupDummyRepo(): void { $currentWorkDir = getcwd(); chdir($this->testDir); @@ -72,7 +72,7 @@ class PharArchiverTest extends ArchiverTest * * @return void */ - protected function writeFile($path, $content, $currentWorkDir) + protected function writeFile($path, $content, $currentWorkDir): void { if (!file_exists(dirname($path))) { mkdir(dirname($path), 0777, true); diff --git a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php index 616768c01..0f1b6e325 100644 --- a/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php +++ b/tests/Composer/Test/Package/Archiver/ZipArchiverTest.php @@ -23,7 +23,7 @@ class ZipArchiverTest extends ArchiverTest * * @dataProvider provideGitignoreExcludeNegationTestCases */ - public function testGitignoreExcludeNegation($include) + public function testGitignoreExcludeNegation($include): void { $this->testZipArchive(array( 'docs/README.md' => '# The doc', @@ -42,7 +42,7 @@ class ZipArchiverTest extends ArchiverTest /** * @param array $files */ - public function testZipArchive(array $files = array()) + public function testZipArchive(array $files = array()): void { if (!class_exists('ZipArchive')) { $this->markTestSkipped('Cannot run ZipArchiverTest, missing class "ZipArchive".'); @@ -87,7 +87,7 @@ class ZipArchiverTest extends ArchiverTest * * @return void */ - protected function setupDummyRepo(array &$files) + protected function setupDummyRepo(array &$files): void { $currentWorkDir = getcwd(); chdir($this->testDir); @@ -108,7 +108,7 @@ class ZipArchiverTest extends ArchiverTest * * @return void */ - protected function writeFile($path, $content, $currentWorkDir) + protected function writeFile($path, $content, $currentWorkDir): void { if (!file_exists(dirname($path))) { mkdir(dirname($path), 0777, true); diff --git a/tests/Composer/Test/Package/BasePackageTest.php b/tests/Composer/Test/Package/BasePackageTest.php index 627bbfb62..0818ee358 100644 --- a/tests/Composer/Test/Package/BasePackageTest.php +++ b/tests/Composer/Test/Package/BasePackageTest.php @@ -20,7 +20,7 @@ class BasePackageTest extends TestCase /** * @doesNotPerformAssertions */ - public function testSetSameRepository() + public function testSetSameRepository(): void { $package = $this->getMockForAbstractClass('Composer\Package\BasePackage', array('foo')); $repository = $this->getMockBuilder('Composer\Repository\RepositoryInterface')->getMock(); @@ -33,7 +33,7 @@ class BasePackageTest extends TestCase } } - public function testSetAnotherRepository() + public function testSetAnotherRepository(): void { self::expectException('LogicException'); @@ -49,7 +49,7 @@ class BasePackageTest extends TestCase * @param bool $truncate * @param string $expected */ - public function testFormatVersionForDevPackage(BasePackage $package, $truncate, $expected) + public function testFormatVersionForDevPackage(BasePackage $package, $truncate, $expected): void { $this->assertSame($expected, $package->getFullPrettyVersion($truncate)); } @@ -99,7 +99,7 @@ class BasePackageTest extends TestCase * * @dataProvider dataPackageNamesToRegexp */ - public function testPackageNamesToRegexp(array $packageNames, $wrap, $expectedRegexp) + public function testPackageNamesToRegexp(array $packageNames, $wrap, $expectedRegexp): void { $regexp = BasePackage::packageNamesToRegexp($packageNames, $wrap); diff --git a/tests/Composer/Test/Package/CompletePackageTest.php b/tests/Composer/Test/Package/CompletePackageTest.php index 848315a1d..a7c3a8806 100644 --- a/tests/Composer/Test/Package/CompletePackageTest.php +++ b/tests/Composer/Test/Package/CompletePackageTest.php @@ -40,7 +40,7 @@ class CompletePackageTest extends TestCase * @param string $name * @param string $version */ - public function testPackageHasExpectedNamingSemantics($name, $version) + public function testPackageHasExpectedNamingSemantics($name, $version): void { $versionParser = new VersionParser(); $normVersion = $versionParser->normalize($version); @@ -54,7 +54,7 @@ class CompletePackageTest extends TestCase * @param string $name * @param string $version */ - public function testPackageHasExpectedVersioningSemantics($name, $version) + public function testPackageHasExpectedVersioningSemantics($name, $version): void { $versionParser = new VersionParser(); $normVersion = $versionParser->normalize($version); @@ -69,7 +69,7 @@ class CompletePackageTest extends TestCase * @param string $name * @param string $version */ - public function testPackageHasExpectedMarshallingSemantics($name, $version) + public function testPackageHasExpectedMarshallingSemantics($name, $version): void { $versionParser = new VersionParser(); $normVersion = $versionParser->normalize($version); @@ -77,7 +77,7 @@ class CompletePackageTest extends TestCase $this->assertEquals(strtolower($name).'-'.$normVersion, (string) $package); } - public function testGetTargetDir() + public function testGetTargetDir(): void { $package = new Package('a', '1.0.0.0', '1.0'); diff --git a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php index f3ab86c3c..624347bd6 100644 --- a/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php +++ b/tests/Composer/Test/Package/Dumper/ArrayDumperTest.php @@ -35,7 +35,7 @@ class ArrayDumperTest extends TestCase $this->packageExpects('getTransportOptions', array()); } - public function testRequiredInformation() + public function testRequiredInformation(): void { $this ->packageExpects('getPrettyName', 'foo') @@ -54,7 +54,7 @@ class ArrayDumperTest extends TestCase ); } - public function testRootPackage() + public function testRootPackage(): void { $this->package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); @@ -67,7 +67,7 @@ class ArrayDumperTest extends TestCase $this->assertSame('dev', $config['minimum-stability']); } - public function testDumpAbandoned() + public function testDumpAbandoned(): void { $this->packageExpects('isAbandoned', true); $this->packageExpects('getReplacementPackage', true); @@ -77,7 +77,7 @@ class ArrayDumperTest extends TestCase $this->assertTrue($config['abandoned']); } - public function testDumpAbandonedReplacement() + public function testDumpAbandonedReplacement(): void { $this->packageExpects('isAbandoned', true); $this->packageExpects('getReplacementPackage', 'foo/bar'); @@ -95,7 +95,7 @@ class ArrayDumperTest extends TestCase * @param string $method * @param mixed $expectedValue */ - public function testKeys($key, $value, $method = null, $expectedValue = null) + public function testKeys($key, $value, $method = null, $expectedValue = null): void { $this->package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); diff --git a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php index 86a016e55..cfe12caa9 100644 --- a/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ArrayLoaderTest.php @@ -29,7 +29,7 @@ class ArrayLoaderTest extends TestCase $this->loader = new ArrayLoader(null); } - public function testSelfVersion() + public function testSelfVersion(): void { $config = array( 'name' => 'A', @@ -44,7 +44,7 @@ class ArrayLoaderTest extends TestCase $this->assertEquals('== 1.2.3.4', (string) $replaces['foo']->getConstraint()); } - public function testTypeDefault() + public function testTypeDefault(): void { $config = array( 'name' => 'A', @@ -64,7 +64,7 @@ class ArrayLoaderTest extends TestCase $this->assertEquals('foo', $package->getType()); } - public function testNormalizedVersionOptimization() + public function testNormalizedVersionOptimization(): void { $config = array( 'name' => 'A', @@ -155,7 +155,7 @@ class ArrayLoaderTest extends TestCase * * @param array $config */ - public function testParseDumpDefaultLoadConfig($config) + public function testParseDumpDefaultLoadConfig($config): void { $package = $this->loader->load($config); $dumper = new ArrayDumper; @@ -168,7 +168,7 @@ class ArrayLoaderTest extends TestCase * * @param array $config */ - public function testParseDumpTrueLoadConfig($config) + public function testParseDumpTrueLoadConfig($config): void { $loader = new ArrayLoader(null, true); $package = $loader->load($config); @@ -182,7 +182,7 @@ class ArrayLoaderTest extends TestCase * * @param array $config */ - public function testParseDumpFalseLoadConfig($config) + public function testParseDumpFalseLoadConfig($config): void { $loader = new ArrayLoader(null, false); $package = $loader->load($config); @@ -191,7 +191,7 @@ class ArrayLoaderTest extends TestCase $this->assertEquals($expectedConfig, $dumper->dump($package)); } - public function testPackageWithBranchAlias() + public function testPackageWithBranchAlias(): void { $config = array( 'name' => 'A', @@ -249,7 +249,7 @@ class ArrayLoaderTest extends TestCase $this->assertEquals('4.x-dev', $package->getPrettyVersion()); } - public function testAbandoned() + public function testAbandoned(): void { $config = array( 'name' => 'A', @@ -262,7 +262,7 @@ class ArrayLoaderTest extends TestCase $this->assertEquals('foo/bar', $package->getReplacementPackage()); } - public function testNotAbandoned() + public function testNotAbandoned(): void { $config = array( 'name' => 'A', @@ -299,7 +299,7 @@ class ArrayLoaderTest extends TestCase * * @param string $apiVersion */ - public function testPluginApiVersionAreKeptAsDeclared($apiVersion) + public function testPluginApiVersionAreKeptAsDeclared($apiVersion): void { $links = $this->loader->parseLinks('Plugin', '9.9.9', Link::TYPE_REQUIRE, array('composer-plugin-api' => $apiVersion)); @@ -307,7 +307,7 @@ class ArrayLoaderTest extends TestCase $this->assertSame($apiVersion, $links['composer-plugin-api']->getConstraint()->getPrettyString()); } - public function testPluginApiVersionDoesSupportSelfVersion() + public function testPluginApiVersionDoesSupportSelfVersion(): void { $links = $this->loader->parseLinks('Plugin', '6.6.6', Link::TYPE_REQUIRE, array('composer-plugin-api' => 'self.version')); @@ -315,7 +315,7 @@ class ArrayLoaderTest extends TestCase $this->assertSame('6.6.6', $links['composer-plugin-api']->getConstraint()->getPrettyString()); } - public function testNoneStringVersion() + public function testNoneStringVersion(): void { $config = array( 'name' => 'acme/package', diff --git a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php index 252fb4840..e963981a8 100644 --- a/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/RootPackageLoaderTest.php @@ -42,7 +42,7 @@ class RootPackageLoaderTest extends TestCase return $loader->load($data); } - public function testStabilityFlagsParsing() + public function testStabilityFlagsParsing(): void { $package = $this->loadPackage(array( 'require' => array( @@ -70,7 +70,7 @@ class RootPackageLoaderTest extends TestCase ), $package->getStabilityFlags()); } - public function testNoVersionIsVisibleInPrettyVersion() + public function testNoVersionIsVisibleInPrettyVersion(): void { $manager = $this->getMockBuilder('Composer\\Repository\\RepositoryManager') ->disableOriginalConstructor() @@ -88,7 +88,7 @@ class RootPackageLoaderTest extends TestCase $this->assertEquals(RootPackage::DEFAULT_PRETTY_VERSION, $package->getPrettyVersion()); } - public function testPrettyVersionForRootPackageInVersionBranch() + public function testPrettyVersionForRootPackageInVersionBranch(): void { // see #6845 $manager = $this->getMockBuilder('Composer\\Repository\\RepositoryManager')->disableOriginalConstructor()->getMock(); @@ -109,7 +109,7 @@ class RootPackageLoaderTest extends TestCase $this->assertEquals('3.0-dev', $package->getPrettyVersion()); } - public function testFeatureBranchPrettyVersion() + public function testFeatureBranchPrettyVersion(): void { if (!function_exists('proc_open')) { $this->markTestSkipped('proc_open() is not available'); @@ -137,7 +137,7 @@ class RootPackageLoaderTest extends TestCase $this->assertEquals("dev-master", $package->getPrettyVersion()); } - public function testNonFeatureBranchPrettyVersion() + public function testNonFeatureBranchPrettyVersion(): void { if (!function_exists('proc_open')) { $this->markTestSkipped('proc_open() is not available'); diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index 68768ca69..509a7f2e2 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -23,7 +23,7 @@ class ValidatingArrayLoaderTest extends TestCase * * @param array $config */ - public function testLoadSuccess($config) + public function testLoadSuccess($config): void { $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock(); $internalLoader @@ -212,7 +212,7 @@ class ValidatingArrayLoaderTest extends TestCase * @param array $config * @param string[] $expectedErrors */ - public function testLoadFailureThrowsException($config, $expectedErrors) + public function testLoadFailureThrowsException($config, $expectedErrors): void { $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock(); $loader = new ValidatingArrayLoader($internalLoader, true, null, ValidatingArrayLoader::CHECK_ALL); @@ -233,7 +233,7 @@ class ValidatingArrayLoaderTest extends TestCase * @param array $config * @param string[] $expectedWarnings */ - public function testLoadWarnings($config, $expectedWarnings) + public function testLoadWarnings($config, $expectedWarnings): void { $internalLoader = $this->getMockBuilder('Composer\Package\Loader\LoaderInterface')->getMock(); $loader = new ValidatingArrayLoader($internalLoader, true, null, ValidatingArrayLoader::CHECK_ALL); @@ -252,7 +252,7 @@ class ValidatingArrayLoaderTest extends TestCase * @param string[] $expectedWarnings * @param bool $mustCheck */ - public function testLoadSkipsWarningDataWhenIgnoringErrors($config, $expectedWarnings, $mustCheck = true) + public function testLoadSkipsWarningDataWhenIgnoringErrors($config, $expectedWarnings, $mustCheck = true): void { if (!$mustCheck) { $this->assertTrue(true); diff --git a/tests/Composer/Test/Package/LockerTest.php b/tests/Composer/Test/Package/LockerTest.php index 3541de44f..17168f62a 100644 --- a/tests/Composer/Test/Package/LockerTest.php +++ b/tests/Composer/Test/Package/LockerTest.php @@ -20,7 +20,7 @@ use Composer\Test\TestCase; class LockerTest extends TestCase { - public function testIsLocked() + public function testIsLocked(): void { $json = $this->createJsonFileMock(); $locker = new Locker( @@ -42,7 +42,7 @@ class LockerTest extends TestCase $this->assertTrue($locker->isLocked()); } - public function testGetNotLockedPackages() + public function testGetNotLockedPackages(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -59,7 +59,7 @@ class LockerTest extends TestCase $locker->getLockedRepository(); } - public function testGetLockedPackages() + public function testGetLockedPackages(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -85,7 +85,7 @@ class LockerTest extends TestCase $this->assertNotNull($repo->findPackage('pkg2', '0.1.10')); } - public function testSetLockData() + public function testSetLockData(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -158,7 +158,7 @@ class LockerTest extends TestCase $locker->setLockData(array($package1, $package2), array(), array(), array(), array(), 'dev', array(), false, false, array('foo/bar' => '1.0')); } - public function testLockBadPackages() + public function testLockBadPackages(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -176,7 +176,7 @@ class LockerTest extends TestCase $locker->setLockData(array($package1), array(), array(), array(), array(), 'dev', array(), false, false, array()); } - public function testIsFresh() + public function testIsFresh(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -192,7 +192,7 @@ class LockerTest extends TestCase $this->assertTrue($locker->isFresh()); } - public function testIsFreshFalse() + public function testIsFreshFalse(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -207,7 +207,7 @@ class LockerTest extends TestCase $this->assertFalse($locker->isFresh()); } - public function testIsFreshWithContentHash() + public function testIsFreshWithContentHash(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -223,7 +223,7 @@ class LockerTest extends TestCase $this->assertTrue($locker->isFresh()); } - public function testIsFreshWithContentHashAndNoHash() + public function testIsFreshWithContentHashAndNoHash(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); @@ -239,7 +239,7 @@ class LockerTest extends TestCase $this->assertTrue($locker->isFresh()); } - public function testIsFreshFalseWithContentHash() + public function testIsFreshFalseWithContentHash(): void { $json = $this->createJsonFileMock(); $inst = $this->createInstallationManagerMock(); diff --git a/tests/Composer/Test/Package/RootAliasPackageTest.php b/tests/Composer/Test/Package/RootAliasPackageTest.php index 72ffbebcb..0a42fd31d 100644 --- a/tests/Composer/Test/Package/RootAliasPackageTest.php +++ b/tests/Composer/Test/Package/RootAliasPackageTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\MockObject\MockObject; class RootAliasPackageTest extends TestCase { - public function testUpdateRequires() + public function testUpdateRequires(): void { $links = array(new Link('a', 'b', new MatchAllConstraint(), Link::TYPE_REQUIRE, 'self.version')); @@ -36,7 +36,7 @@ class RootAliasPackageTest extends TestCase $this->assertNotEmpty($alias->getRequires()); } - public function testUpdateDevRequires() + public function testUpdateDevRequires(): void { $links = array(new Link('a', 'b', new MatchAllConstraint(), Link::TYPE_DEV_REQUIRE, 'self.version')); @@ -51,7 +51,7 @@ class RootAliasPackageTest extends TestCase $this->assertNotEmpty($alias->getDevRequires()); } - public function testUpdateConflicts() + public function testUpdateConflicts(): void { $links = array(new Link('a', 'b', new MatchAllConstraint(), Link::TYPE_CONFLICT, 'self.version')); @@ -66,7 +66,7 @@ class RootAliasPackageTest extends TestCase $this->assertNotEmpty($alias->getConflicts()); } - public function testUpdateProvides() + public function testUpdateProvides(): void { $links = array(new Link('a', 'b', new MatchAllConstraint(), Link::TYPE_PROVIDE, 'self.version')); @@ -81,7 +81,7 @@ class RootAliasPackageTest extends TestCase $this->assertNotEmpty($alias->getProvides()); } - public function testUpdateReplaces() + public function testUpdateReplaces(): void { $links = array(new Link('a', 'b', new MatchAllConstraint(), Link::TYPE_REPLACE, 'self.version')); diff --git a/tests/Composer/Test/Package/Version/VersionGuesserTest.php b/tests/Composer/Test/Package/Version/VersionGuesserTest.php index 5bb666180..4ec717681 100644 --- a/tests/Composer/Test/Package/Version/VersionGuesserTest.php +++ b/tests/Composer/Test/Package/Version/VersionGuesserTest.php @@ -28,7 +28,7 @@ class VersionGuesserTest extends TestCase } } - public function testHgGuessVersionReturnsData() + public function testHgGuessVersionReturnsData(): void { $branch = 'default'; @@ -54,7 +54,7 @@ class VersionGuesserTest extends TestCase $this->assertEmpty($versionArray['commit']); } - public function testGuessVersionReturnsData() + public function testGuessVersionReturnsData(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; $anotherCommitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -79,7 +79,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals($commitHash, $versionArray['commit']); } - public function testGuessVersionDoesNotSeeCustomDefaultBranchAsNonFeatureBranch() + public function testGuessVersionDoesNotSeeCustomDefaultBranchAsNonFeatureBranch(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; $anotherCommitHash = '13a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -102,7 +102,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals($anotherCommitHash, $versionArray['commit']); } - public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNaming() + public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNaming(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; $anotherCommitHash = '13a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -130,7 +130,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-feature", $versionArray['feature_pretty_version']); } - public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingRegex() + public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingRegex(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; $anotherCommitHash = '13a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -158,7 +158,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-feature", $versionArray['feature_pretty_version']); } - public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingWhenOnNonFeatureBranch() + public function testGuessVersionReadsAndRespectsNonFeatureBranchesConfigurationForArbitraryNamingWhenOnNonFeatureBranch(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; $anotherCommitHash = '13a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -182,7 +182,7 @@ class VersionGuesserTest extends TestCase $this->assertArrayNotHasKey('feature_pretty_version', $versionArray); } - public function testDetachedHeadBecomesDevHash() + public function testDetachedHeadBecomesDevHash(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -203,7 +203,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-$commitHash", $versionData['version']); } - public function testDetachedFetchHeadBecomesDevHashGit2() + public function testDetachedFetchHeadBecomesDevHashGit2(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -224,7 +224,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-$commitHash", $versionData['version']); } - public function testDetachedCommitHeadBecomesDevHashGit2() + public function testDetachedCommitHeadBecomesDevHashGit2(): void { $commitHash = '03a15d220da53c52eddd5f32ffca64a7b3801bea'; @@ -245,7 +245,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-$commitHash", $versionData['version']); } - public function testTagBecomesVersion() + public function testTagBecomesVersion(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -267,7 +267,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("2.0.5.0-alpha2", $versionData['version']); } - public function testTagBecomesPrettyVersion() + public function testTagBecomesPrettyVersion(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -290,7 +290,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals('1.0.0', $versionData['pretty_version']); } - public function testInvalidTagBecomesVersion() + public function testInvalidTagBecomesVersion(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -308,7 +308,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("dev-foo", $versionData['version']); } - public function testNumericBranchesShowNicely() + public function testNumericBranchesShowNicely(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( @@ -327,7 +327,7 @@ class VersionGuesserTest extends TestCase $this->assertEquals("1.5.9999999.9999999-dev", $versionData['version']); } - public function testRemoteBranchesAreSelected() + public function testRemoteBranchesAreSelected(): void { $process = $this->getProcessExecutorMock(); $process->expects(array( diff --git a/tests/Composer/Test/Package/Version/VersionParserTest.php b/tests/Composer/Test/Package/Version/VersionParserTest.php index 8277a0c0e..c8bdf21fb 100644 --- a/tests/Composer/Test/Package/Version/VersionParserTest.php +++ b/tests/Composer/Test/Package/Version/VersionParserTest.php @@ -23,7 +23,7 @@ class VersionParserTest extends TestCase * @param string[] $pairs * @param array> $result */ - public function testParseNameVersionPairs($pairs, $result) + public function testParseNameVersionPairs($pairs, $result): void { $versionParser = new VersionParser(); @@ -48,7 +48,7 @@ class VersionParserTest extends TestCase * @param string $to * @param bool $expected */ - public function testIsUpgrade($from, $to, $expected) + public function testIsUpgrade($from, $to, $expected): void { $this->assertSame($expected, VersionParser::isUpgrade($from, $to)); } diff --git a/tests/Composer/Test/Package/Version/VersionSelectorTest.php b/tests/Composer/Test/Package/Version/VersionSelectorTest.php index 027534c6e..05c2d6e0d 100644 --- a/tests/Composer/Test/Package/Version/VersionSelectorTest.php +++ b/tests/Composer/Test/Package/Version/VersionSelectorTest.php @@ -27,7 +27,7 @@ class VersionSelectorTest extends TestCase // B) targetPackageVersion will pass to repo set // C) No results, throw exception - public function testLatestVersionIsReturned() + public function testLatestVersionIsReturned(): void { $packageName = 'foobar'; @@ -49,7 +49,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be 1.2.2'); } - public function testLatestVersionIsReturnedThatMatchesPhpRequirements() + public function testLatestVersionIsReturnedThatMatchesPhpRequirements(): void { $packageName = 'foobar'; @@ -75,7 +75,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)'); } - public function testLatestVersionIsReturnedThatMatchesExtRequirements() + public function testLatestVersionIsReturnedThatMatchesExtRequirements(): void { $packageName = 'foobar'; @@ -101,7 +101,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)'); } - public function testLatestVersionIsReturnedThatMatchesPlatformExt() + public function testLatestVersionIsReturnedThatMatchesPlatformExt(): void { $packageName = 'foobar'; @@ -126,7 +126,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (2.0.0)'); } - public function testLatestVersionIsReturnedThatMatchesComposerRequirements() + public function testLatestVersionIsReturnedThatMatchesComposerRequirements(): void { $packageName = 'foobar'; @@ -152,7 +152,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned when ignoring platform reqs (1.1.0)'); } - public function testMostStableVersionIsReturned() + public function testMostStableVersionIsReturned(): void { $packageName = 'foobar'; @@ -172,7 +172,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package1, $best, 'Latest most stable version should be returned (1.0.0)'); } - public function testMostStableVersionIsReturnedRegardlessOfOrder() + public function testMostStableVersionIsReturnedRegardlessOfOrder(): void { $packageName = 'foobar'; @@ -197,7 +197,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Expecting 2.0.0-beta3, cause beta is more stable than dev'); } - public function testHighestVersionIsReturned() + public function testHighestVersionIsReturned(): void { $packageName = 'foobar'; @@ -217,7 +217,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)'); } - public function testHighestVersionMatchingStabilityIsReturned() + public function testHighestVersionMatchingStabilityIsReturned(): void { $packageName = 'foobar'; @@ -238,7 +238,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)'); } - public function testMostStableUnstableVersionIsReturned() + public function testMostStableUnstableVersionIsReturned(): void { $packageName = 'foobar'; @@ -258,7 +258,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned (1.1.0-beta)'); } - public function testDefaultBranchAliasIsNeverReturned() + public function testDefaultBranchAliasIsNeverReturned(): void { $packageName = 'foobar'; @@ -279,7 +279,7 @@ class VersionSelectorTest extends TestCase $this->assertSame($package2, $best, 'Latest version should be returned (dev-main)'); } - public function testFalseReturnedOnNoPackages() + public function testFalseReturnedOnNoPackages(): void { $repositorySet = $this->createMockRepositorySet(); $repositorySet->expects($this->once()) @@ -299,7 +299,7 @@ class VersionSelectorTest extends TestCase * @param string|null $branchAlias * @param string $packageName */ - public function testFindRecommendedRequireVersion($prettyVersion, $expectedVersion, $branchAlias = null, $packageName = 'foo/bar') + public function testFindRecommendedRequireVersion($prettyVersion, $expectedVersion, $branchAlias = null, $packageName = 'foo/bar'): void { $repositorySet = $this->createMockRepositorySet(); $versionSelector = new VersionSelector($repositorySet); diff --git a/tests/Composer/Test/Platform/HhvmDetectorTest.php b/tests/Composer/Test/Platform/HhvmDetectorTest.php index 736a8ae43..d3881a74d 100644 --- a/tests/Composer/Test/Platform/HhvmDetectorTest.php +++ b/tests/Composer/Test/Platform/HhvmDetectorTest.php @@ -31,7 +31,7 @@ class HhvmDetectorTest extends TestCase $this->hhvmDetector->reset(); } - public function testHHVMVersionWhenExecutingInHHVM() + public function testHHVMVersionWhenExecutingInHHVM(): void { if (!defined('HHVM_VERSION_ID')) { self::markTestSkipped('Not running with HHVM'); @@ -40,7 +40,7 @@ class HhvmDetectorTest extends TestCase self::assertSame(self::versionIdToVersion(), $version); } - public function testHHVMVersionWhenExecutingInPHP() + public function testHHVMVersionWhenExecutingInPHP(): void { if (defined('HHVM_VERSION_ID')) { self::markTestSkipped('Running with HHVM'); diff --git a/tests/Composer/Test/Platform/VersionTest.php b/tests/Composer/Test/Platform/VersionTest.php index 3ebb03724..447cbc991 100644 --- a/tests/Composer/Test/Platform/VersionTest.php +++ b/tests/Composer/Test/Platform/VersionTest.php @@ -79,7 +79,7 @@ class VersionTest extends TestCase * @param bool $fipsExpected * @param string|null $normalizedVersion */ - public function testParseOpensslVersions($input, $parsedVersion, $fipsExpected = false, $normalizedVersion = null) + public function testParseOpensslVersions($input, $parsedVersion, $fipsExpected = false, $normalizedVersion = null): void { self::assertSame($parsedVersion, Version::parseOpenssl($input, $isFips)); self::assertSame($fipsExpected, $isFips); @@ -104,7 +104,7 @@ class VersionTest extends TestCase * @param string $input * @param string $parsedVersion */ - public function testParseLibjpegVersion($input, $parsedVersion) + public function testParseLibjpegVersion($input, $parsedVersion): void { self::assertSame($parsedVersion, Version::parseLibjpeg($input)); } @@ -124,7 +124,7 @@ class VersionTest extends TestCase * @param string $input * @param string $parsedVersion */ - public function testParseZoneinfoVersion($input, $parsedVersion) + public function testParseZoneinfoVersion($input, $parsedVersion): void { self::assertSame($parsedVersion, Version::parseZoneinfoVersion($input)); } diff --git a/tests/Composer/Test/Plugin/PluginInstallerTest.php b/tests/Composer/Test/Plugin/PluginInstallerTest.php index 43022a20d..0bba37da8 100644 --- a/tests/Composer/Test/Plugin/PluginInstallerTest.php +++ b/tests/Composer/Test/Plugin/PluginInstallerTest.php @@ -135,7 +135,7 @@ class PluginInstallerTest extends TestCase $filesystem->removeDirectory($this->directory); } - public function testInstallNewPlugin() + public function testInstallNewPlugin(): void { $this->repository ->expects($this->any()) @@ -154,7 +154,7 @@ class PluginInstallerTest extends TestCase ); } - public function testInstallPluginWithRootPackageHavingFilesAutoload() + public function testInstallPluginWithRootPackageHavingFilesAutoload(): void { $this->repository ->expects($this->any()) @@ -176,7 +176,7 @@ class PluginInstallerTest extends TestCase $this->assertEquals('installer-v1', $plugins[0]->version); // @phpstan-ignore-line } - public function testInstallMultiplePlugins() + public function testInstallMultiplePlugins(): void { $this->repository ->expects($this->any()) @@ -195,7 +195,7 @@ class PluginInstallerTest extends TestCase $this->assertEquals('activate v4-plugin1'.PHP_EOL.'activate v4-plugin2'.PHP_EOL, $this->io->getOutput()); } - public function testUpgradeWithNewClassName() + public function testUpgradeWithNewClassName(): void { $this->repository ->expects($this->any()) @@ -216,7 +216,7 @@ class PluginInstallerTest extends TestCase $this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'activate v2'.PHP_EOL, $this->io->getOutput()); } - public function testUninstall() + public function testUninstall(): void { $this->repository ->expects($this->any()) @@ -236,7 +236,7 @@ class PluginInstallerTest extends TestCase $this->assertEquals('activate v1'.PHP_EOL.'deactivate v1'.PHP_EOL.'uninstall v1'.PHP_EOL, $this->io->getOutput()); } - public function testUpgradeWithSameClassName() + public function testUpgradeWithSameClassName(): void { $this->repository ->expects($this->any()) @@ -256,7 +256,7 @@ class PluginInstallerTest extends TestCase $this->assertEquals('activate v2'.PHP_EOL.'deactivate v2'.PHP_EOL.'activate v3'.PHP_EOL, $this->io->getOutput()); } - public function testRegisterPluginOnlyOneTime() + public function testRegisterPluginOnlyOneTime(): void { $this->repository ->expects($this->any()) @@ -280,7 +280,7 @@ class PluginInstallerTest extends TestCase * * @return void */ - private function setPluginApiVersionWithPlugins($newPluginApiVersion, array $plugins = array()) + private function setPluginApiVersionWithPlugins($newPluginApiVersion, array $plugins = array()): void { // reset the plugin manager's installed plugins $this->pm = $this->getMockBuilder('Composer\Plugin\PluginManager') @@ -310,7 +310,7 @@ class PluginInstallerTest extends TestCase $this->pm->loadInstalledPlugins(); } - public function testStarPluginVersionWorksWithAnyAPIVersion() + public function testStarPluginVersionWorksWithAnyAPIVersion(): void { $starVersionPlugin = array($this->packages[4]); @@ -327,7 +327,7 @@ class PluginInstallerTest extends TestCase $this->assertCount(1, $this->pm->getPlugins()); } - public function testPluginConstraintWorksOnlyWithCertainAPIVersion() + public function testPluginConstraintWorksOnlyWithCertainAPIVersion(): void { $pluginWithApiConstraint = array($this->packages[5]); @@ -344,7 +344,7 @@ class PluginInstallerTest extends TestCase $this->assertCount(1, $this->pm->getPlugins()); } - public function testPluginRangeConstraintsWorkOnlyWithCertainAPIVersion() + public function testPluginRangeConstraintsWorkOnlyWithCertainAPIVersion(): void { $pluginWithApiConstraint = array($this->packages[6]); @@ -358,7 +358,7 @@ class PluginInstallerTest extends TestCase $this->assertCount(0, $this->pm->getPlugins()); } - public function testCommandProviderCapability() + public function testCommandProviderCapability(): void { $this->repository ->expects($this->any()) @@ -377,14 +377,14 @@ class PluginInstallerTest extends TestCase $this->assertInstanceOf('Composer\Command\BaseCommand', $commands[0]); } - public function testIncapablePluginIsCorrectlyDetected() + public function testIncapablePluginIsCorrectlyDetected(): void { $plugin = $this->getMockBuilder('Composer\Plugin\PluginInterface') ->getMock(); $this->assertNull($this->pm->getPluginCapability($plugin, 'Fake\Ability')); } - public function testCapabilityImplementsComposerPluginApiClassAndIsConstructedWithArgs() + public function testCapabilityImplementsComposerPluginApiClassAndIsConstructedWithArgs(): void { $capabilityApi = 'Composer\Plugin\Capability\Capability'; $capabilityImplementation = 'Composer\Test\Plugin\Mock\Capability'; @@ -437,7 +437,7 @@ class PluginInstallerTest extends TestCase * * @return void */ - public function testQueryingWithInvalidCapabilityClassNameThrows($invalidImplementationClassNames, $expect = 'UnexpectedValueException') + public function testQueryingWithInvalidCapabilityClassNameThrows($invalidImplementationClassNames, $expect = 'UnexpectedValueException'): void { self::expectException($expect); @@ -456,7 +456,7 @@ class PluginInstallerTest extends TestCase } /** @return void */ - public function testQueryingNonProvidedCapabilityReturnsNullSafely() + public function testQueryingNonProvidedCapabilityReturnsNullSafely(): void { $capabilityApi = 'Composer\Plugin\Capability\MadeUpCapability'; @@ -478,7 +478,7 @@ class PluginInstallerTest extends TestCase * * @return void */ - public function testQueryingWithNonExistingOrWrongCapabilityClassTypesThrows($wrongImplementationClassTypes) + public function testQueryingWithNonExistingOrWrongCapabilityClassTypesThrows($wrongImplementationClassTypes): void { $this->testQueryingWithInvalidCapabilityClassNameThrows($wrongImplementationClassTypes, 'RuntimeException'); } diff --git a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php index 925f278bb..ed996717d 100644 --- a/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php +++ b/tests/Composer/Test/Question/StrictConfirmationQuestionTest.php @@ -45,7 +45,7 @@ class StrictConfirmationQuestionTest extends TestCase * * @param string $answer */ - public function testAskConfirmationBadAnswer($answer) + public function testAskConfirmationBadAnswer($answer): void { list($input, $dialog) = $this->createInput($answer."\n"); @@ -64,7 +64,7 @@ class StrictConfirmationQuestionTest extends TestCase * @param bool $expected * @param bool $default */ - public function testAskConfirmation($question, $expected, $default = true) + public function testAskConfirmation($question, $expected, $default = true): void { list($input, $dialog) = $this->createInput($question."\n"); @@ -89,7 +89,7 @@ class StrictConfirmationQuestionTest extends TestCase ); } - public function testAskConfirmationWithCustomTrueAndFalseAnswer() + public function testAskConfirmationWithCustomTrueAndFalseAnswer(): void { $question = new StrictConfirmationQuestion('Do you like French fries?', false, '/^ja$/i', '/^nein$/i'); diff --git a/tests/Composer/Test/Repository/ArrayRepositoryTest.php b/tests/Composer/Test/Repository/ArrayRepositoryTest.php index fe50a29b2..f2261eac2 100644 --- a/tests/Composer/Test/Repository/ArrayRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArrayRepositoryTest.php @@ -18,7 +18,7 @@ use Composer\Test\TestCase; class ArrayRepositoryTest extends TestCase { - public function testAddPackage() + public function testAddPackage(): void { $repo = new ArrayRepository; $repo->addPackage($this->getPackage('foo', '1')); @@ -26,7 +26,7 @@ class ArrayRepositoryTest extends TestCase $this->assertCount(1, $repo); } - public function testRemovePackage() + public function testRemovePackage(): void { $package = $this->getPackage('bar', '2'); @@ -42,7 +42,7 @@ class ArrayRepositoryTest extends TestCase $this->assertEquals(array($package), $repo->getPackages()); } - public function testHasPackage() + public function testHasPackage(): void { $repo = new ArrayRepository; $repo->addPackage($this->getPackage('foo', '1')); @@ -52,7 +52,7 @@ class ArrayRepositoryTest extends TestCase $this->assertFalse($repo->hasPackage($this->getPackage('bar', '1'))); } - public function testFindPackages() + public function testFindPackages(): void { $repo = new ArrayRepository(); $repo->addPackage($this->getPackage('foo', '1')); @@ -68,7 +68,7 @@ class ArrayRepositoryTest extends TestCase $this->assertEquals('bar', $bar[0]->getName()); } - public function testAutomaticallyAddAliasedPackageButNotRemove() + public function testAutomaticallyAddAliasedPackageButNotRemove(): void { $repo = new ArrayRepository(); @@ -86,7 +86,7 @@ class ArrayRepositoryTest extends TestCase $this->assertCount(1, $repo); } - public function testSearch() + public function testSearch(): void { $repo = new ArrayRepository(); @@ -108,7 +108,7 @@ class ArrayRepositoryTest extends TestCase ); } - public function testSearchWithPackageType() + public function testSearchWithPackageType(): void { $repo = new ArrayRepository(); @@ -132,7 +132,7 @@ class ArrayRepositoryTest extends TestCase ); } - public function testSearchWithAbandonedPackages() + public function testSearchWithAbandonedPackages(): void { $repo = new ArrayRepository(); diff --git a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php index 49c37a61a..d3075278c 100644 --- a/tests/Composer/Test/Repository/ArtifactRepositoryTest.php +++ b/tests/Composer/Test/Repository/ArtifactRepositoryTest.php @@ -27,7 +27,7 @@ class ArtifactRepositoryTest extends TestCase } } - public function testExtractsConfigsFromZipArchives() + public function testExtractsConfigsFromZipArchives(): void { $expectedPackages = array( 'vendor0/package0-0.0.1', @@ -61,7 +61,7 @@ class ArtifactRepositoryTest extends TestCase $this->assertSame('tar', $tarPackage->getDistType()); } - public function testAbsoluteRepoUrlCreatesAbsoluteUrlPackages() + public function testAbsoluteRepoUrlCreatesAbsoluteUrlPackages(): void { $absolutePath = __DIR__ . '/Fixtures/artifacts'; $coordinates = array('type' => 'artifact', 'url' => $absolutePath); @@ -72,7 +72,7 @@ class ArtifactRepositoryTest extends TestCase } } - public function testRelativeRepoUrlCreatesRelativeUrlPackages() + public function testRelativeRepoUrlCreatesRelativeUrlPackages(): void { $relativePath = 'tests/Composer/Test/Repository/Fixtures/artifacts'; $coordinates = array('type' => 'artifact', 'url' => $relativePath); diff --git a/tests/Composer/Test/Repository/ComposerRepositoryTest.php b/tests/Composer/Test/Repository/ComposerRepositoryTest.php index 21b9f56be..8c941cc1b 100644 --- a/tests/Composer/Test/Repository/ComposerRepositoryTest.php +++ b/tests/Composer/Test/Repository/ComposerRepositoryTest.php @@ -28,7 +28,7 @@ class ComposerRepositoryTest extends TestCase * @param mixed[] $expected * @param array $repoPackages */ - public function testLoadData(array $expected, array $repoPackages) + public function testLoadData(array $expected, array $repoPackages): void { $repoConfig = array( 'url' => 'http://example.org', @@ -92,7 +92,7 @@ class ComposerRepositoryTest extends TestCase ); } - public function testWhatProvides() + public function testWhatProvides(): void { $repo = $this->getMockBuilder('Composer\Repository\ComposerRepository') ->setConstructorArgs(array( @@ -156,7 +156,7 @@ class ComposerRepositoryTest extends TestCase $this->assertSame($packages['2'], $packages['2-alias']->getAliasOf()); } - public function testSearchWithType() + public function testSearchWithType(): void { $repoConfig = array( 'url' => 'http://example.org', @@ -198,7 +198,7 @@ class ComposerRepositoryTest extends TestCase ); } - public function testSearchWithSpecialChars() + public function testSearchWithSpecialChars(): void { $repoConfig = array( 'url' => 'http://example.org', @@ -225,7 +225,7 @@ class ComposerRepositoryTest extends TestCase ); } - public function testSearchWithAbandonedPackages() + public function testSearchWithAbandonedPackages(): void { $repoConfig = array( 'url' => 'http://example.org', @@ -279,7 +279,7 @@ class ComposerRepositoryTest extends TestCase * @param string $url * @param string $repositoryUrl */ - public function testCanonicalizeUrl($expected, $url, $repositoryUrl) + public function testCanonicalizeUrl($expected, $url, $repositoryUrl): void { $repository = new ComposerRepository( array('url' => $repositoryUrl), @@ -341,7 +341,7 @@ class ComposerRepositoryTest extends TestCase ); } - public function testGetProviderNamesWillReturnPartialPackageNames() + public function testGetProviderNamesWillReturnPartialPackageNames(): void { $httpDownloader = $this->getHttpDownloaderMock(); $httpDownloader->expects( diff --git a/tests/Composer/Test/Repository/CompositeRepositoryTest.php b/tests/Composer/Test/Repository/CompositeRepositoryTest.php index 5e49d725a..daec344d2 100644 --- a/tests/Composer/Test/Repository/CompositeRepositoryTest.php +++ b/tests/Composer/Test/Repository/CompositeRepositoryTest.php @@ -18,7 +18,7 @@ use Composer\Test\TestCase; class CompositeRepositoryTest extends TestCase { - public function testHasPackage() + public function testHasPackage(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -35,7 +35,7 @@ class CompositeRepositoryTest extends TestCase $this->assertFalse($repo->hasPackage($this->getPackage('bar', '2')), "Should not have package 'bar/2'"); } - public function testFindPackage() + public function testFindPackage(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -52,7 +52,7 @@ class CompositeRepositoryTest extends TestCase $this->assertNull($repo->findPackage('foo', '2'), "Should not find package 'foo/2'"); } - public function testFindPackages() + public function testFindPackages(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -79,7 +79,7 @@ class CompositeRepositoryTest extends TestCase $this->assertEquals('foo', $foos[0]->getName(), "Should find packages named 'foo'"); } - public function testGetPackages() + public function testGetPackages(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -97,7 +97,7 @@ class CompositeRepositoryTest extends TestCase $this->assertEquals("1", $packages[1]->getPrettyVersion(), "Second package should have pretty version of '1'"); } - public function testAddRepository() + public function testAddRepository(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -113,7 +113,7 @@ class CompositeRepositoryTest extends TestCase $this->assertCount(4, $repo, "Composite repository should have four packages after addRepository() is called"); } - public function testCount() + public function testCount(): void { $arrayRepoOne = new ArrayRepository; $arrayRepoOne->addPackage($this->getPackage('foo', '1')); @@ -132,7 +132,7 @@ class CompositeRepositoryTest extends TestCase * @param string $method * @param mixed[] $args */ - public function testNoRepositories($method, $args) + public function testNoRepositories($method, $args): void { $repo = new CompositeRepository(array()); $this->assertEquals(array(), call_user_func_array(array($repo, $method), $args)); diff --git a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php index ac1d78e4d..fd2667a7f 100644 --- a/tests/Composer/Test/Repository/FilesystemRepositoryTest.php +++ b/tests/Composer/Test/Repository/FilesystemRepositoryTest.php @@ -21,7 +21,7 @@ use Composer\Util\Filesystem; class FilesystemRepositoryTest extends TestCase { - public function testRepositoryRead() + public function testRepositoryRead(): void { $json = $this->createJsonFileMock(); @@ -46,7 +46,7 @@ class FilesystemRepositoryTest extends TestCase $this->assertSame('vendor', $packages[0]->getType()); } - public function testCorruptedRepositoryFile() + public function testCorruptedRepositoryFile(): void { self::expectException('Composer\Repository\InvalidRepositoryException'); $json = $this->createJsonFileMock(); @@ -65,7 +65,7 @@ class FilesystemRepositoryTest extends TestCase $repository->getPackages(); } - public function testUnexistentRepositoryFile() + public function testUnexistentRepositoryFile(): void { $json = $this->createJsonFileMock(); @@ -79,7 +79,7 @@ class FilesystemRepositoryTest extends TestCase $this->assertEquals(array(), $repository->getPackages()); } - public function testRepositoryWrite() + public function testRepositoryWrite(): void { $json = $this->createJsonFileMock(); @@ -125,7 +125,7 @@ class FilesystemRepositoryTest extends TestCase $repository->write(true, $im); } - public function testRepositoryWritesInstalledPhp() + public function testRepositoryWritesInstalledPhp(): void { $dir = $this->getUniqueTmpDirectory(); chdir($dir); diff --git a/tests/Composer/Test/Repository/FilterRepositoryTest.php b/tests/Composer/Test/Repository/FilterRepositoryTest.php index d18e8a13e..70678ec10 100644 --- a/tests/Composer/Test/Repository/FilterRepositoryTest.php +++ b/tests/Composer/Test/Repository/FilterRepositoryTest.php @@ -40,7 +40,7 @@ class FilterRepositoryTest extends TestCase * @param string[] $expected * @param array{only?: array, exclude?: array, canonical?: bool} $config */ - public function testRepoMatching($expected, $config) + public function testRepoMatching($expected, $config): void { $repo = new FilterRepository($this->arrayRepo, $config); $packages = $repo->getPackages(); @@ -62,7 +62,7 @@ class FilterRepositoryTest extends TestCase ); } - public function testCanonicalDefaultTrue() + public function testCanonicalDefaultTrue(): void { $repo = new FilterRepository($this->arrayRepo, array()); $result = $repo->loadPackages(array('foo/aaa' => new MatchAllConstraint), BasePackage::$stabilities, array()); @@ -70,7 +70,7 @@ class FilterRepositoryTest extends TestCase $this->assertCount(1, $result['namesFound']); } - public function testNonCanonical() + public function testNonCanonical(): void { $repo = new FilterRepository($this->arrayRepo, array('canonical' => false)); $result = $repo->loadPackages(array('foo/aaa' => new MatchAllConstraint), BasePackage::$stabilities, array()); diff --git a/tests/Composer/Test/Repository/InstalledRepositoryTest.php b/tests/Composer/Test/Repository/InstalledRepositoryTest.php index 136c19c7b..c4f32a1a5 100644 --- a/tests/Composer/Test/Repository/InstalledRepositoryTest.php +++ b/tests/Composer/Test/Repository/InstalledRepositoryTest.php @@ -21,7 +21,7 @@ use Composer\Test\TestCase; class InstalledRepositoryTest extends TestCase { - public function testFindPackagesWithReplacersAndProviders() + public function testFindPackagesWithReplacersAndProviders(): void { $arrayRepoOne = new InstalledArrayRepository; $arrayRepoOne->addPackage($foo = $this->getPackage('foo', '1')); @@ -41,7 +41,7 @@ class InstalledRepositoryTest extends TestCase $this->assertEquals(array($foo, $bar2), $repo->findPackagesWithReplacersAndProviders('provided')); } - public function testAddRepository() + public function testAddRepository(): void { $arrayRepoOne = new ArrayRepository; diff --git a/tests/Composer/Test/Repository/PathRepositoryTest.php b/tests/Composer/Test/Repository/PathRepositoryTest.php index bff6fd6b2..9717a4457 100644 --- a/tests/Composer/Test/Repository/PathRepositoryTest.php +++ b/tests/Composer/Test/Repository/PathRepositoryTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class PathRepositoryTest extends TestCase { - public function testLoadPackageFromFileSystemWithIncorrectPath() + public function testLoadPackageFromFileSystemWithIncorrectPath(): void { self::expectException('RuntimeException'); $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') @@ -30,7 +30,7 @@ class PathRepositoryTest extends TestCase $repository->getPackages(); } - public function testLoadPackageFromFileSystemWithVersion() + public function testLoadPackageFromFileSystemWithVersion(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -46,7 +46,7 @@ class PathRepositoryTest extends TestCase $this->assertTrue($repository->hasPackage($this->getPackage('test/path-versioned', '0.0.2'))); } - public function testLoadPackageFromFileSystemWithoutVersion() + public function testLoadPackageFromFileSystemWithoutVersion(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -67,7 +67,7 @@ class PathRepositoryTest extends TestCase $this->assertNotEmpty($packageVersion); } - public function testLoadPackageFromFileSystemWithWildcard() + public function testLoadPackageFromFileSystemWithWildcard(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -92,7 +92,7 @@ class PathRepositoryTest extends TestCase $this->assertEquals(array('test/path-unversioned', 'test/path-versioned'), $names); } - public function testLoadPackageWithExplicitVersions() + public function testLoadPackageWithExplicitVersions(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -127,7 +127,7 @@ class PathRepositoryTest extends TestCase /** * Verify relative repository URLs remain relative, see #4439 */ - public function testUrlRemainsRelative() + public function testUrlRemainsRelative(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -155,7 +155,7 @@ class PathRepositoryTest extends TestCase $this->assertSame($relativeUrl, $package->getDistUrl()); } - public function testReferenceNone() + public function testReferenceNone(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); @@ -176,7 +176,7 @@ class PathRepositoryTest extends TestCase } } - public function testReferenceConfig() + public function testReferenceConfig(): void { $ioInterface = $this->getMockBuilder('Composer\IO\IOInterface') ->getMock(); diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index 05f030eac..96cdaa21a 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -21,7 +21,7 @@ use PHPUnit\Framework\Assert; class PlatformRepositoryTest extends TestCase { - public function testHhvmPackage() + public function testHhvmPackage(): void { $hhvmDetector = $this->getMockBuilder('Composer\Platform\HhvmDetector')->getMock(); $platformRepository = new PlatformRepository(array(), array(), null, $hhvmDetector); @@ -120,7 +120,7 @@ class PlatformRepositoryTest extends TestCase * @param array $packages * @param list, string|bool}> $functions */ - public function testPhpVersion(array $constants, array $packages, array $functions = array()) + public function testPhpVersion(array $constants, array $packages, array $functions = array()): void { $runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock(); $runtime @@ -152,7 +152,7 @@ class PlatformRepositoryTest extends TestCase } } - public function testInetPtonRegression() + public function testInetPtonRegression(): void { $runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock(); @@ -1097,7 +1097,7 @@ Linked Version => 1.2.11', array $functions = array(), array $constants = array(), array $classDefinitions = array() - ) { + ): void { $extensions = (array) $extensions; $extensionVersion = '100.200.300'; @@ -1204,7 +1204,7 @@ Linked Version => 1.2.11', * * @return void */ - private function assertPackageLinks($context, array $expectedLinks, PackageInterface $sourcePackage, array $links) + private function assertPackageLinks($context, array $expectedLinks, PackageInterface $sourcePackage, array $links): void { self::assertCount(count($expectedLinks), $links, sprintf('%s: expected package count to match', $context)); @@ -1215,7 +1215,7 @@ Linked Version => 1.2.11', } } - public function testComposerPlatformVersion() + public function testComposerPlatformVersion(): void { $runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock(); $runtime @@ -1268,7 +1268,7 @@ Linked Version => 1.2.11', * @param bool $expectation * @dataProvider providePlatformPackages */ - public function testValidPlatformPackages($packageName, $expectation) + public function testValidPlatformPackages($packageName, $expectation): void { self::assertSame($expectation, PlatformRepository::isPlatformPackage($packageName)); } diff --git a/tests/Composer/Test/Repository/RepositoryFactoryTest.php b/tests/Composer/Test/Repository/RepositoryFactoryTest.php index ab725b18f..9e890a99d 100644 --- a/tests/Composer/Test/Repository/RepositoryFactoryTest.php +++ b/tests/Composer/Test/Repository/RepositoryFactoryTest.php @@ -17,7 +17,7 @@ use Composer\Test\TestCase; class RepositoryFactoryTest extends TestCase { - public function testManagerWithAllRepositoryTypes() + public function testManagerWithAllRepositoryTypes(): void { $manager = RepositoryFactory::manager( $this->getMockBuilder('Composer\IO\IOInterface')->getMock(), @@ -59,7 +59,7 @@ class RepositoryFactoryTest extends TestCase * * @phpstan-param array{url?: string} $config */ - public function testGenerateRepositoryName($index, array $config, array $existingRepos, $expected) + public function testGenerateRepositoryName($index, array $config, array $existingRepos, $expected): void { $this->assertSame($expected, RepositoryFactory::generateRepositoryName($index, $config, $existingRepos)); } diff --git a/tests/Composer/Test/Repository/RepositoryManagerTest.php b/tests/Composer/Test/Repository/RepositoryManagerTest.php index 1596c0a40..e326f98ce 100644 --- a/tests/Composer/Test/Repository/RepositoryManagerTest.php +++ b/tests/Composer/Test/Repository/RepositoryManagerTest.php @@ -35,7 +35,7 @@ class RepositoryManagerTest extends TestCase } } - public function testPrepend() + public function testPrepend(): void { $rm = new RepositoryManager( $this->getMockBuilder('Composer\IO\IOInterface')->getMock(), @@ -59,7 +59,7 @@ class RepositoryManagerTest extends TestCase * @param array $options * @param class-string<\Throwable>|null $exception */ - public function testRepoCreation($type, $options, ?string $exception = null) + public function testRepoCreation($type, $options, ?string $exception = null): void { if ($exception !== null) { self::expectException($exception); @@ -115,7 +115,7 @@ class RepositoryManagerTest extends TestCase return $cases; } - public function testFilterRepoWrapping() + public function testFilterRepoWrapping(): void { $rm = new RepositoryManager( $this->getMockBuilder('Composer\IO\IOInterface')->getMock(), diff --git a/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php b/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php index 06c6bd5b6..d6afde937 100644 --- a/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/FossilDriverTest.php @@ -61,7 +61,7 @@ class FossilDriverTest extends TestCase * @param string $url * @param bool $assertion */ - public function testSupport($url, $assertion) + public function testSupport($url, $assertion): void { $config = new Config(); $result = FossilDriver::supports($this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $config, $url); diff --git a/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php index 66de8b7eb..1643769ae 100644 --- a/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitBitbucketDriverTest.php @@ -79,7 +79,7 @@ class GitBitbucketDriverTest extends TestCase return $driver; } - public function testGetRootIdentifierWrongScmType() + public function testGetRootIdentifierWrongScmType(): void { 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'); @@ -195,7 +195,7 @@ class GitBitbucketDriverTest extends TestCase * @depends testDriver * @param \Composer\Repository\Vcs\VcsDriverInterface $driver */ - public function testGetParams($driver) + public function testGetParams($driver): void { $url = 'https://bitbucket.org/user/repo.git'; @@ -217,7 +217,7 @@ class GitBitbucketDriverTest extends TestCase ); } - public function testInitializeInvalidRepositoryUrl() + public function testInitializeInvalidRepositoryUrl(): void { $this->expectException('\InvalidArgumentException'); @@ -225,7 +225,7 @@ class GitBitbucketDriverTest extends TestCase $driver->initialize(); } - public function testSupports() + public function testSupports(): void { $this->assertTrue( GitBitbucketDriver::supports($this->io, $this->config, 'https://bitbucket.org/user/repo.git') diff --git a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php index 7a721a1be..74576d98a 100644 --- a/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitHubDriverTest.php @@ -44,7 +44,7 @@ class GitHubDriverTest extends TestCase $fs->removeDirectory($this->home); } - public function testPrivateRepository() + public function testPrivateRepository(): void { $repoUrl = 'http://github.com/composer/packagist'; $repoApiUrl = 'https://api.github.com/repos/composer/packagist'; @@ -105,7 +105,7 @@ class GitHubDriverTest extends TestCase $this->assertEquals('SOMESHA', $source['reference']); } - public function testPublicRepository() + public function testPublicRepository(): void { $repoUrl = 'http://github.com/composer/packagist'; $repoApiUrl = 'https://api.github.com/repos/composer/packagist'; @@ -147,7 +147,7 @@ class GitHubDriverTest extends TestCase $this->assertEquals($sha, $source['reference']); } - public function testPublicRepository2() + public function testPublicRepository2(): void { $repoUrl = 'http://github.com/composer/packagist'; $repoApiUrl = 'https://api.github.com/repos/composer/packagist'; @@ -196,7 +196,7 @@ class GitHubDriverTest extends TestCase $this->assertArrayNotHasKey('abandoned', $data); } - public function testPublicRepositoryArchived() + public function testPublicRepositoryArchived(): void { $repoUrl = 'http://github.com/composer/packagist'; $repoApiUrl = 'https://api.github.com/repos/composer/packagist'; @@ -233,7 +233,7 @@ class GitHubDriverTest extends TestCase $this->assertTrue($data['abandoned']); } - public function testPrivateRepositoryNoInteraction() + public function testPrivateRepositoryNoInteraction(): void { $repoUrl = 'http://github.com/composer/packagist'; $repoApiUrl = 'https://api.github.com/repos/composer/packagist'; @@ -305,7 +305,7 @@ class GitHubDriverTest extends TestCase /** * @return void */ - public function initializeInvalidReoUrl() + public function initializeInvalidReoUrl(): void { $this->expectException('\InvalidArgumentException'); @@ -327,7 +327,7 @@ class GitHubDriverTest extends TestCase * @param bool $expected * @param string $repoUrl */ - public function testSupports($expected, $repoUrl) + public function testSupports($expected, $repoUrl): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); @@ -353,7 +353,7 @@ class GitHubDriverTest extends TestCase * * @return void */ - protected function setAttribute($object, $attribute, $value) + protected function setAttribute($object, $attribute, $value): void { $attr = new \ReflectionProperty($object, $attribute); $attr->setAccessible(true); diff --git a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php index e2b79774d..e00c69a19 100644 --- a/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/GitLabDriverTest.php @@ -215,7 +215,7 @@ JSON; * * @group gitlabHttpPort */ - public function testInitializeWithPortNumber() + public function testInitializeWithPortNumber(): void { $domain = 'gitlab.mycompany.com'; $port = '5443'; @@ -249,7 +249,7 @@ JSON; $this->assertEquals($url, $driver->getUrl()); } - public function testGetDist() + public function testGetDist(): void { $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -264,7 +264,7 @@ JSON; $this->assertEquals($expected, $driver->getDist($reference)); } - public function testGetSource() + public function testGetSource(): void { $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -278,7 +278,7 @@ JSON; $this->assertEquals($expected, $driver->getSource($reference)); } - public function testGetSource_GivenPublicProject() + public function testGetSource_GivenPublicProject(): void { $driver = $this->testInitializePublicProject('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -292,7 +292,7 @@ JSON; $this->assertEquals($expected, $driver->getSource($reference)); } - public function testGetTags() + public function testGetTags(): void { $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -333,7 +333,7 @@ JSON; $this->assertEquals($expected, $driver->getTags(), 'Tags are cached'); } - public function testGetPaginatedRefs() + public function testGetPaginatedRefs(): void { $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -395,7 +395,7 @@ JSON; $this->assertEquals($expected, $driver->getBranches(), 'Branches are cached'); } - public function testGetBranches() + public function testGetBranches(): void { $driver = $this->testInitialize('https://gitlab.com/mygroup/myproject', 'https://gitlab.com/api/v4/projects/mygroup%2Fmyproject'); @@ -444,7 +444,7 @@ JSON; * @param string $url * @param bool $expected */ - public function testSupports($url, $expected) + public function testSupports($url, $expected): void { $this->assertSame($expected, GitLabDriver::supports($this->io, $this->config, $url)); } @@ -473,7 +473,7 @@ JSON; ); } - public function testGitlabSubDirectory() + public function testGitlabSubDirectory(): void { $url = 'https://mycompany.com/gitlab/mygroup/my-pro.ject'; $apiUrl = 'https://mycompany.com/gitlab/api/v4/projects/mygroup%2Fmy-pro%2Eject'; @@ -505,7 +505,7 @@ JSON; $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL'); } - public function testGitlabSubGroup() + public function testGitlabSubGroup(): void { $url = 'https://gitlab.com/mygroup/mysubgroup/myproject'; $apiUrl = 'https://gitlab.com/api/v4/projects/mygroup%2Fmysubgroup%2Fmyproject'; @@ -537,7 +537,7 @@ JSON; $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL'); } - public function testGitlabSubDirectorySubGroup() + public function testGitlabSubDirectorySubGroup(): void { $url = 'https://mycompany.com/gitlab/mygroup/mysubgroup/myproject'; $apiUrl = 'https://mycompany.com/gitlab/api/v4/projects/mygroup%2Fmysubgroup%2Fmyproject'; @@ -569,7 +569,7 @@ JSON; $this->assertEquals($apiUrl, $driver->getApiUrl(), 'API URL is derived from the repository URL'); } - public function testForwardsOptions() + public function testForwardsOptions(): void { $options = array( 'ssl' => array( @@ -607,7 +607,7 @@ JSON; $driver->initialize(); } - public function testProtocolOverrideRepositoryUrlGeneration() + public function testProtocolOverrideRepositoryUrlGeneration(): void { // @link http://doc.gitlab.com/ce/api/projects.html#get-single-project $projectData = <<assertTrue( HgDriver::supports($this->io, $this->config, $repositoryUrl) diff --git a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php index a918b7ff9..058bbc4c7 100644 --- a/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/PerforceDriverTest.php @@ -89,7 +89,7 @@ class PerforceDriverTest extends TestCase /** * @return void */ - protected function overrideDriverInternalPerforce(Perforce $perforce) + protected function overrideDriverInternalPerforce(Perforce $perforce): void { $reflectionClass = new \ReflectionClass($this->driver); $property = $reflectionClass->getProperty('perforce'); @@ -136,7 +136,7 @@ class PerforceDriverTest extends TestCase return $this->getMockBuilder('Composer\Util\Perforce')->disableOriginalConstructor()->getMock(); } - public function testInitializeCapturesVariablesFromRepoConfig() + public function testInitializeCapturesVariablesFromRepoConfig(): void { $driver = new PerforceDriver($this->repoConfig, $this->io, $this->config, $this->httpDownloader, $this->process); $driver->initialize(); @@ -145,7 +145,7 @@ class PerforceDriverTest extends TestCase $this->assertEquals(self::TEST_BRANCH, $driver->getBranch()); } - public function testInitializeLogsInAndConnectsClient() + public function testInitializeLogsInAndConnectsClient(): void { $this->perforce->expects($this->once())->method('p4Login'); $this->perforce->expects($this->once())->method('checkStream'); @@ -158,7 +158,7 @@ class PerforceDriverTest extends TestCase * @depends testInitializeCapturesVariablesFromRepoConfig * @depends testInitializeLogsInAndConnectsClient */ - public function testHasComposerFileReturnsFalseOnNoComposerFile() + public function testHasComposerFileReturnsFalseOnNoComposerFile(): void { $identifier = 'TEST_IDENTIFIER'; $formatted_depot_path = '//' . self::TEST_DEPOT . '/' . $identifier; @@ -172,7 +172,7 @@ class PerforceDriverTest extends TestCase * @depends testInitializeCapturesVariablesFromRepoConfig * @depends testInitializeLogsInAndConnectsClient */ - public function testHasComposerFileReturnsTrueWithOneOrMoreComposerFiles() + public function testHasComposerFileReturnsTrueWithOneOrMoreComposerFiles(): void { $identifier = 'TEST_IDENTIFIER'; $formatted_depot_path = '//' . self::TEST_DEPOT . '/' . $identifier; @@ -189,13 +189,13 @@ class PerforceDriverTest extends TestCase * * @return void */ - public function testSupportsReturnsFalseNoDeepCheck() + public function testSupportsReturnsFalseNoDeepCheck(): void { $this->expectOutputString(''); $this->assertFalse(PerforceDriver::supports($this->io, $this->config, 'existing.url')); } - public function testCleanup() + public function testCleanup(): void { $this->perforce->expects($this->once())->method('cleanupClientSpec'); $this->driver->cleanup(); diff --git a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php index e3b32b9bf..892cda1c8 100644 --- a/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php +++ b/tests/Composer/Test/Repository/Vcs/SvnDriverTest.php @@ -47,7 +47,7 @@ class SvnDriverTest extends TestCase $fs->removeDirectory($this->home); } - public function testWrongCredentialsInUrl() + public function testWrongCredentialsInUrl(): void { self::expectException('RuntimeException'); self::expectExceptionMessage("Repository https://till:secret@corp.svn.local/repo could not be processed, wrong credentials provided (svn: OPTIONS of 'https://corp.svn.local/repo': authorization failed: Could not authenticate to server: rejected Basic challenge (https://corp.svn.local/))"); @@ -100,7 +100,7 @@ class SvnDriverTest extends TestCase * @param string $url * @param bool $assertion */ - public function testSupport($url, $assertion) + public function testSupport($url, $assertion): void { $config = new Config(); $result = SvnDriver::supports($this->getMockBuilder('Composer\IO\IOInterface')->getMock(), $config, $url); diff --git a/tests/Composer/Test/Repository/VcsRepositoryTest.php b/tests/Composer/Test/Repository/VcsRepositoryTest.php index 470c9bced..819dcd08d 100644 --- a/tests/Composer/Test/Repository/VcsRepositoryTest.php +++ b/tests/Composer/Test/Repository/VcsRepositoryTest.php @@ -42,7 +42,7 @@ class VcsRepositoryTest extends TestCase /** * @return void */ - protected function initialize() + protected function initialize(): void { $locator = new ExecutableFinder(); if (!$locator->find('git')) { @@ -63,7 +63,7 @@ class VcsRepositoryTest extends TestCase // init $process = new ProcessExecutor; - $exec = function ($command) use ($process) { + $exec = function ($command) use ($process): void { $cwd = getcwd(); if ($process->execute($command, $output, $cwd) !== 0) { throw new \RuntimeException('Failed to execute '.$command.': '.$process->getErrorOutput()); @@ -147,7 +147,7 @@ class VcsRepositoryTest extends TestCase $fs->removeDirectory(self::$gitRepo); } - public function testLoadVersions() + public function testLoadVersions(): void { $expected = array( '0.6.0' => true, diff --git a/tests/Composer/Test/Script/EventTest.php b/tests/Composer/Test/Script/EventTest.php index 8ef3c916b..561d0b300 100644 --- a/tests/Composer/Test/Script/EventTest.php +++ b/tests/Composer/Test/Script/EventTest.php @@ -19,7 +19,7 @@ use Composer\Test\TestCase; class EventTest extends TestCase { - public function testEventSetsOriginatingEvent() + public function testEventSetsOriginatingEvent(): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $composer = $this->createComposerInstance(); @@ -43,7 +43,7 @@ class EventTest extends TestCase ); } - public function testEventCalculatesNestedOriginatingEvent() + public function testEventCalculatesNestedOriginatingEvent(): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $composer = $this->createComposerInstance(); diff --git a/tests/Composer/Test/TestCase.php b/tests/Composer/Test/TestCase.php index e6a171621..380bd2550 100644 --- a/tests/Composer/Test/TestCase.php +++ b/tests/Composer/Test/TestCase.php @@ -152,7 +152,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase * @param array> $config * @return void */ - protected function configureLinks(PackageInterface $package, array $config) + protected function configureLinks(PackageInterface $package, array $config): void { $arrayLoader = new ArrayLoader(); @@ -175,7 +175,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase * @param string $directory * @return void */ - protected static function ensureDirectoryExistsAndClear($directory) + protected static function ensureDirectoryExistsAndClear($directory): void { $fs = new Filesystem(); @@ -195,7 +195,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase * * @throws \PHPUnit\Framework\SkippedTestError */ - protected function skipIfNotExecutable($executableName) + protected function skipIfNotExecutable($executableName): void { if (!isset(self::$executableCache[$executableName])) { $finder = new ExecutableFinder(); diff --git a/tests/Composer/Test/Util/AuthHelperTest.php b/tests/Composer/Test/Util/AuthHelperTest.php index a65d022c1..5fccfda3a 100644 --- a/tests/Composer/Test/Util/AuthHelperTest.php +++ b/tests/Composer/Test/Util/AuthHelperTest.php @@ -43,7 +43,7 @@ class AuthHelperTest extends TestCase $this->authHelper = new AuthHelper($this->io, $this->config); } - public function testAddAuthenticationHeaderWithoutAuthCredentials() + public function testAddAuthenticationHeaderWithoutAuthCredentials(): void { $headers = array( 'Accept-Encoding: gzip', @@ -63,7 +63,7 @@ class AuthHelperTest extends TestCase ); } - public function testAddAuthenticationHeaderWithBearerPassword() + public function testAddAuthenticationHeaderWithBearerPassword(): void { $headers = array( 'Accept-Encoding: gzip', @@ -86,7 +86,7 @@ class AuthHelperTest extends TestCase ); } - public function testAddAuthenticationHeaderWithGithubToken() + public function testAddAuthenticationHeaderWithGithubToken(): void { $headers = array( 'Accept-Encoding: gzip', @@ -113,7 +113,7 @@ class AuthHelperTest extends TestCase ); } - public function testAddAuthenticationHeaderWithGitlabOathToken() + public function testAddAuthenticationHeaderWithGitlabOathToken(): void { $headers = array( 'Accept-Encoding: gzip', @@ -158,7 +158,7 @@ class AuthHelperTest extends TestCase * * @param string $password */ - public function testAddAuthenticationHeaderWithGitlabPrivateToken($password) + public function testAddAuthenticationHeaderWithGitlabPrivateToken($password): void { $headers = array( 'Accept-Encoding: gzip', @@ -190,7 +190,7 @@ class AuthHelperTest extends TestCase ); } - public function testAddAuthenticationHeaderWithBitbucketOathToken() + public function testAddAuthenticationHeaderWithBitbucketOathToken(): void { $headers = array( 'Accept-Encoding: gzip', @@ -235,7 +235,7 @@ class AuthHelperTest extends TestCase * * @param string $url */ - public function testAddAuthenticationHeaderWithBitbucketPublicUrl($url) + public function testAddAuthenticationHeaderWithBitbucketPublicUrl($url): void { $headers = array( 'Accept-Encoding: gzip', @@ -299,7 +299,7 @@ class AuthHelperTest extends TestCase * * @phpstan-param array{username: string|null, password: string|null} $auth */ - public function testAddAuthenticationHeaderWithBasicHttpAuthentication($url, $origin, $auth) + public function testAddAuthenticationHeaderWithBasicHttpAuthentication($url, $origin, $auth): void { $headers = array( 'Accept-Encoding: gzip', @@ -337,12 +337,12 @@ class AuthHelperTest extends TestCase * * @param string $url */ - public function testIsPublicBitBucketDownloadWithBitbucketPublicUrl($url) + public function testIsPublicBitBucketDownloadWithBitbucketPublicUrl($url): void { $this->assertTrue($this->authHelper->isPublicBitBucketDownload($url)); } - public function testIsPublicBitBucketDownloadWithNonBitbucketPublicUrl() + public function testIsPublicBitBucketDownloadWithNonBitbucketPublicUrl(): void { $this->assertFalse( $this->authHelper->isPublicBitBucketDownload( @@ -351,7 +351,7 @@ class AuthHelperTest extends TestCase ); } - public function testStoreAuthAutomatically() + public function testStoreAuthAutomatically(): void { $origin = 'github.com'; $storeAuth = true; @@ -383,7 +383,7 @@ class AuthHelperTest extends TestCase $this->authHelper->storeAuth($origin, $storeAuth); } - public function testStoreAuthWithPromptYesAnswer() + public function testStoreAuthWithPromptYesAnswer(): void { $origin = 'github.com'; $storeAuth = 'prompt'; @@ -435,7 +435,7 @@ class AuthHelperTest extends TestCase $this->authHelper->storeAuth($origin, $storeAuth); } - public function testStoreAuthWithPromptNoAnswer() + public function testStoreAuthWithPromptNoAnswer(): void { $origin = 'github.com'; $storeAuth = 'prompt'; @@ -473,7 +473,7 @@ class AuthHelperTest extends TestCase $this->authHelper->storeAuth($origin, $storeAuth); } - public function testStoreAuthWithPromptInvalidAnswer() + public function testStoreAuthWithPromptInvalidAnswer(): void { self::expectException('RuntimeException'); @@ -521,7 +521,7 @@ class AuthHelperTest extends TestCase * * @phpstan-param array{username: string|null, password: string|null} $auth */ - private function expectsAuthentication($origin, $auth) + private function expectsAuthentication($origin, $auth): void { $this->io->expects($this->once()) ->method('hasAuthentication') diff --git a/tests/Composer/Test/Util/BitbucketTest.php b/tests/Composer/Test/Util/BitbucketTest.php index afc7f7aa2..a39202a51 100644 --- a/tests/Composer/Test/Util/BitbucketTest.php +++ b/tests/Composer/Test/Util/BitbucketTest.php @@ -68,7 +68,7 @@ class BitbucketTest extends TestCase $this->bitbucket = new Bitbucket($this->io, $this->config, null, $this->httpDownloader, $this->time); } - public function testRequestAccessTokenWithValidOAuthConsumer() + public function testRequestAccessTokenWithValidOAuthConsumer(): void { $this->io->expects($this->once()) ->method('setAuthentication') @@ -135,7 +135,7 @@ class BitbucketTest extends TestCase return $this->bitbucket; } - public function testRequestAccessTokenWithValidOAuthConsumerAndExpiredAccessToken() + public function testRequestAccessTokenWithValidOAuthConsumerAndExpiredAccessToken(): void { $this->config->expects($this->once()) ->method('get') @@ -187,7 +187,7 @@ class BitbucketTest extends TestCase ); } - public function testRequestAccessTokenWithUsernameAndPassword() + public function testRequestAccessTokenWithUsernameAndPassword(): void { $this->io->expects($this->once()) ->method('setAuthentication') @@ -232,7 +232,7 @@ class BitbucketTest extends TestCase $this->assertEquals('', $this->bitbucket->requestToken($this->origin, $this->username, $this->password)); } - public function testRequestAccessTokenWithUsernameAndPasswordWithUnauthorizedResponse() + public function testRequestAccessTokenWithUsernameAndPasswordWithUnauthorizedResponse(): void { $this->config->expects($this->once()) ->method('get') @@ -267,7 +267,7 @@ class BitbucketTest extends TestCase $this->assertEquals('', $this->bitbucket->requestToken($this->origin, $this->username, $this->password)); } - public function testRequestAccessTokenWithUsernameAndPasswordWithNotFoundResponse() + public function testRequestAccessTokenWithUsernameAndPasswordWithNotFoundResponse(): void { self::expectException('Composer\Downloader\TransportException'); $this->config->expects($this->once()) @@ -297,7 +297,7 @@ class BitbucketTest extends TestCase $this->bitbucket->requestToken($this->origin, $this->username, $this->password); } - public function testUsernamePasswordAuthenticationFlow() + public function testUsernamePasswordAuthenticationFlow(): void { $this->io ->expects($this->atLeastOnce()) @@ -338,7 +338,7 @@ class BitbucketTest extends TestCase $this->assertTrue($this->bitbucket->authorizeOAuthInteractively($this->origin, $this->message)); } - public function testAuthorizeOAuthInteractivelyWithEmptyUsername() + public function testAuthorizeOAuthInteractivelyWithEmptyUsername(): void { $authConfigSourceMock = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); $this->config->expects($this->atLeastOnce()) @@ -353,7 +353,7 @@ class BitbucketTest extends TestCase $this->assertFalse($this->bitbucket->authorizeOAuthInteractively($this->origin, $this->message)); } - public function testAuthorizeOAuthInteractivelyWithEmptyPassword() + public function testAuthorizeOAuthInteractivelyWithEmptyPassword(): void { $authConfigSourceMock = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); $this->config->expects($this->atLeastOnce()) @@ -371,7 +371,7 @@ class BitbucketTest extends TestCase $this->assertFalse($this->bitbucket->authorizeOAuthInteractively($this->origin, $this->message)); } - public function testAuthorizeOAuthInteractivelyWithRequestAccessTokenFailure() + public function testAuthorizeOAuthInteractivelyWithRequestAccessTokenFailure(): void { $authConfigSourceMock = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); $this->config->expects($this->atLeastOnce()) @@ -411,7 +411,7 @@ class BitbucketTest extends TestCase * * @return void */ - private function setExpectationsForStoringAccessToken($removeBasicAuth = false) + private function setExpectationsForStoringAccessToken($removeBasicAuth = false): void { $configSourceMock = $this->getMockBuilder('Composer\Config\ConfigSourceInterface')->getMock(); $this->config->expects($this->once()) @@ -446,7 +446,7 @@ class BitbucketTest extends TestCase } } - public function testGetTokenWithoutAccessToken() + public function testGetTokenWithoutAccessToken(): void { $this->assertSame('', $this->bitbucket->getToken()); } @@ -456,17 +456,17 @@ class BitbucketTest extends TestCase * * @param Bitbucket $bitbucket */ - public function testGetTokenWithAccessToken(Bitbucket $bitbucket) + public function testGetTokenWithAccessToken(Bitbucket $bitbucket): void { $this->assertSame($this->token, $bitbucket->getToken()); } - public function testAuthorizeOAuthWithWrongOriginUrl() + public function testAuthorizeOAuthWithWrongOriginUrl(): void { $this->assertFalse($this->bitbucket->authorizeOAuth('non-' . $this->origin)); } - public function testAuthorizeOAuthWithoutAvailableGitConfigToken() + public function testAuthorizeOAuthWithoutAvailableGitConfigToken(): void { $process = $this->getProcessExecutorMock(); $process->expects(array(), false, array('return' => -1)); @@ -476,7 +476,7 @@ class BitbucketTest extends TestCase $this->assertFalse($bitbucket->authorizeOAuth($this->origin)); } - public function testAuthorizeOAuthWithAvailableGitConfigToken() + public function testAuthorizeOAuthWithAvailableGitConfigToken(): void { $process = $this->getProcessExecutorMock(); diff --git a/tests/Composer/Test/Util/ConfigValidatorTest.php b/tests/Composer/Test/Util/ConfigValidatorTest.php index 0e53e1c54..c755ea6e5 100644 --- a/tests/Composer/Test/Util/ConfigValidatorTest.php +++ b/tests/Composer/Test/Util/ConfigValidatorTest.php @@ -24,7 +24,7 @@ class ConfigValidatorTest extends TestCase /** * Test ConfigValidator warns on commit reference */ - public function testConfigValidatorCommitRefWarning() + public function testConfigValidatorCommitRefWarning(): void { $configValidator = new ConfigValidator(new NullIO()); list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_commit-ref.json'); @@ -35,7 +35,7 @@ class ConfigValidatorTest extends TestCase ); } - public function testConfigValidatorWarnsOnScriptDescriptionForNonexistentScript() + public function testConfigValidatorWarnsOnScriptDescriptionForNonexistentScript(): void { $configValidator = new ConfigValidator(new NullIO()); list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_scripts-descriptions.json'); @@ -46,7 +46,7 @@ class ConfigValidatorTest extends TestCase ); } - public function testConfigValidatorWarnsOnUnnecessaryProvideReplace() + public function testConfigValidatorWarnsOnUnnecessaryProvideReplace(): void { $configValidator = new ConfigValidator(new NullIO()); list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_provide-replace-requirements.json'); diff --git a/tests/Composer/Test/Util/ErrorHandlerTest.php b/tests/Composer/Test/Util/ErrorHandlerTest.php index 6dc0c8ec6..4def526a4 100644 --- a/tests/Composer/Test/Util/ErrorHandlerTest.php +++ b/tests/Composer/Test/Util/ErrorHandlerTest.php @@ -34,7 +34,7 @@ class ErrorHandlerTest extends TestCase /** * Test ErrorHandler handles notices */ - public function testErrorHandlerCaptureNotice() + public function testErrorHandlerCaptureNotice(): void { if (PHP_VERSION_ID >= 80000) { self::expectException('\ErrorException'); @@ -52,7 +52,7 @@ class ErrorHandlerTest extends TestCase /** * Test ErrorHandler handles warnings */ - public function testErrorHandlerCaptureWarning() + public function testErrorHandlerCaptureWarning(): void { if (PHP_VERSION_ID >= 80000) { self::expectException('TypeError'); @@ -70,7 +70,7 @@ class ErrorHandlerTest extends TestCase * Test ErrorHandler handles warnings * @doesNotPerformAssertions */ - public function testErrorHandlerRespectsAtOperator() + public function testErrorHandlerRespectsAtOperator(): void { @trigger_error('test', E_USER_NOTICE); } diff --git a/tests/Composer/Test/Util/FilesystemTest.php b/tests/Composer/Test/Util/FilesystemTest.php index 2c7fa5657..38d2f8fd5 100644 --- a/tests/Composer/Test/Util/FilesystemTest.php +++ b/tests/Composer/Test/Util/FilesystemTest.php @@ -59,7 +59,7 @@ class FilesystemTest extends TestCase * @param string $expected * @param bool $static */ - public function testFindShortestPathCode($a, $b, $directory, $expected, $static = false) + public function testFindShortestPathCode($a, $b, $directory, $expected, $static = false): void { $fs = new Filesystem; $this->assertEquals($expected, $fs->findShortestPathCode($a, $b, $directory, $static)); @@ -122,7 +122,7 @@ class FilesystemTest extends TestCase * @param string $expected * @param bool $directory */ - public function testFindShortestPath($a, $b, $expected, $directory = false) + public function testFindShortestPath($a, $b, $expected, $directory = false): void { $fs = new Filesystem; $this->assertEquals($expected, $fs->findShortestPath($a, $b, $directory)); @@ -173,7 +173,7 @@ class FilesystemTest extends TestCase /** * @group GH-1339 */ - public function testRemoveDirectoryPhp() + public function testRemoveDirectoryPhp(): void { @mkdir($this->workingDir . "/level1/level2", 0777, true); file_put_contents($this->workingDir . "/level1/level2/hello.txt", "hello world"); @@ -183,7 +183,7 @@ class FilesystemTest extends TestCase $this->assertFileDoesNotExist($this->workingDir . "/level1/level2/hello.txt"); } - public function testFileSize() + public function testFileSize(): void { file_put_contents($this->testFile, 'Hello'); @@ -191,7 +191,7 @@ class FilesystemTest extends TestCase $this->assertGreaterThanOrEqual(5, $fs->size($this->testFile)); } - public function testDirectorySize() + public function testDirectorySize(): void { @mkdir($this->workingDir, 0777, true); file_put_contents($this->workingDir."/file1.txt", 'Hello'); @@ -207,7 +207,7 @@ class FilesystemTest extends TestCase * @param string $expected * @param string $actual */ - public function testNormalizePath($expected, $actual) + public function testNormalizePath($expected, $actual): void { $fs = new Filesystem; $this->assertEquals($expected, $fs->normalizePath($actual)); @@ -243,7 +243,7 @@ class FilesystemTest extends TestCase * @link https://github.com/composer/composer/issues/3157 * @requires function symlink */ - public function testUnlinkSymlinkedDirectory() + public function testUnlinkSymlinkedDirectory(): void { $basepath = $this->workingDir; $symlinked = $basepath . "/linked"; @@ -270,7 +270,7 @@ class FilesystemTest extends TestCase * @link https://github.com/composer/composer/issues/3144 * @requires function symlink */ - public function testRemoveSymlinkedDirectoryWithTrailingSlash() + public function testRemoveSymlinkedDirectoryWithTrailingSlash(): void { @mkdir($this->workingDir . "/real", 0777, true); touch($this->workingDir . "/real/FILE"); @@ -299,7 +299,7 @@ class FilesystemTest extends TestCase $this->assertFileDoesNotExist($symlinked); } - public function testJunctions() + public function testJunctions(): void { @mkdir($this->workingDir . '/real/nesting/testing', 0777, true); $fs = new Filesystem(); @@ -329,7 +329,7 @@ class FilesystemTest extends TestCase $this->assertFalse(is_dir($junction), $junction . ' is not a directory'); } - public function testCopy() + public function testCopy(): void { @mkdir($this->workingDir . '/foo/bar', 0777, true); @mkdir($this->workingDir . '/foo/baz', 0777, true); @@ -354,7 +354,7 @@ class FilesystemTest extends TestCase $this->assertTrue(is_file($this->workingDir . '/testfile.file')); } - public function testCopyThenRemove() + public function testCopyThenRemove(): void { @mkdir($this->workingDir . '/foo/bar', 0777, true); @mkdir($this->workingDir . '/foo/baz', 0777, true); diff --git a/tests/Composer/Test/Util/GitHubTest.php b/tests/Composer/Test/Util/GitHubTest.php index 0da22733a..a4151f489 100644 --- a/tests/Composer/Test/Util/GitHubTest.php +++ b/tests/Composer/Test/Util/GitHubTest.php @@ -27,7 +27,7 @@ class GitHubTest extends TestCase /** @var string */ private $origin = 'github.com'; - public function testUsernamePasswordAuthenticationFlow() + public function testUsernamePasswordAuthenticationFlow(): void { $io = $this->getIOMock(); $io @@ -65,7 +65,7 @@ class GitHubTest extends TestCase $this->assertTrue($github->authorizeOAuthInteractively($this->origin, $this->message)); } - public function testUsernamePasswordFailure() + public function testUsernamePasswordFailure(): void { $io = $this->getIOMock(); $io diff --git a/tests/Composer/Test/Util/GitLabTest.php b/tests/Composer/Test/Util/GitLabTest.php index 397b164ad..61bc35c72 100644 --- a/tests/Composer/Test/Util/GitLabTest.php +++ b/tests/Composer/Test/Util/GitLabTest.php @@ -31,7 +31,7 @@ class GitLabTest extends TestCase /** @var string */ private $token = 'gitlabtoken'; - public function testUsernamePasswordAuthenticationFlow() + public function testUsernamePasswordAuthenticationFlow(): void { $io = $this->getIOMock(); $io @@ -70,7 +70,7 @@ class GitLabTest extends TestCase $this->assertTrue($gitLab->authorizeOAuthInteractively('http', $this->origin, $this->message)); } - public function testUsernamePasswordFailure() + public function testUsernamePasswordFailure(): void { self::expectException('RuntimeException'); self::expectExceptionMessage('Invalid GitLab credentials 5 times in a row, aborting.'); diff --git a/tests/Composer/Test/Util/GitTest.php b/tests/Composer/Test/Util/GitTest.php index 9379d5b2e..6c88e1a4f 100644 --- a/tests/Composer/Test/Util/GitTest.php +++ b/tests/Composer/Test/Util/GitTest.php @@ -47,7 +47,7 @@ class GitTest extends TestCase * @param string $protocol * @param string $expectedUrl */ - public function testRunCommandPublicGitHubRepositoryNotInitialClone($protocol, $expectedUrl) + public function testRunCommandPublicGitHubRepositoryNotInitialClone($protocol, $expectedUrl): void { $commandCallable = function ($url) use ($expectedUrl) { $this->assertSame($expectedUrl, $url); @@ -70,7 +70,7 @@ class GitTest extends TestCase ); } - public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithoutAuthentication() + public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithoutAuthentication(): void { self::expectException('RuntimeException'); @@ -99,7 +99,7 @@ class GitTest extends TestCase * @param string $expectedUrl * @param int $expectedFailuresBeforeSuccess */ - public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication($gitUrl, $protocol, $gitHubToken, $expectedUrl, $expectedFailuresBeforeSuccess) + public function testRunCommandPrivateGitHubRepositoryNotInitialCloneNotInteractiveWithAuthentication($gitUrl, $protocol, $gitHubToken, $expectedUrl, $expectedFailuresBeforeSuccess): void { $commandCallable = function ($url) use ($expectedUrl) { if ($url !== $expectedUrl) { @@ -148,7 +148,7 @@ class GitTest extends TestCase * * @return void */ - private function mockConfig($protocol) + private function mockConfig($protocol): void { $this->config ->method('get') diff --git a/tests/Composer/Test/Util/Http/ProxyHelperTest.php b/tests/Composer/Test/Util/Http/ProxyHelperTest.php index 72e1d2f6d..5998289fb 100644 --- a/tests/Composer/Test/Util/Http/ProxyHelperTest.php +++ b/tests/Composer/Test/Util/Http/ProxyHelperTest.php @@ -49,7 +49,7 @@ class ProxyHelperTest extends TestCase * * @param string $url */ - public function testThrowsOnMalformedUrl($url) + public function testThrowsOnMalformedUrl($url): void { $_SERVER['http_proxy'] = $url; @@ -71,7 +71,7 @@ class ProxyHelperTest extends TestCase * @param string $url * @param string $expected */ - public function testUrlFormatting($url, $expected) + public function testUrlFormatting($url, $expected): void { $_SERVER['http_proxy'] = $url; @@ -96,7 +96,7 @@ class ProxyHelperTest extends TestCase * @param string $expected * @param int $index */ - public function testLowercaseOverridesUppercase(array $server, $expected, $index) + public function testLowercaseOverridesUppercase(array $server, $expected, $index): void { $_SERVER = array_merge($_SERVER, $server); @@ -121,7 +121,7 @@ class ProxyHelperTest extends TestCase * @param string $expected * @param int $index */ - public function testCGIUpperCaseOverridesHttp(array $server, $expected, $index) + public function testCGIUpperCaseOverridesHttp(array $server, $expected, $index): void { $_SERVER = array_merge($_SERVER, $server); @@ -138,7 +138,7 @@ class ProxyHelperTest extends TestCase ); } - public function testNoHttpsProxyUsesHttpProxy() + public function testNoHttpsProxyUsesHttpProxy(): void { $_SERVER['http_proxy'] = 'http://http.com'; @@ -146,7 +146,7 @@ class ProxyHelperTest extends TestCase $this->assertSame('http://http.com:80', $httpsProxy); } - public function testNoHttpProxyDoesNotUseHttpsProxy() + public function testNoHttpProxyDoesNotUseHttpsProxy(): void { $_SERVER['https_proxy'] = 'http://https.com'; @@ -162,7 +162,7 @@ class ProxyHelperTest extends TestCase * * @phpstan-param array{http: array{proxy: string, header?: string}} $expected */ - public function testGetContextOptions($url, $expected) + public function testGetContextOptions($url, $expected): void { $this->assertEquals($expected, ProxyHelper::getContextOptions($url)); } @@ -190,7 +190,7 @@ class ProxyHelperTest extends TestCase * @param string $requestUrl * @param mixed[] $expected */ - public function testSetRequestFullUri($requestUrl, $expected) + public function testSetRequestFullUri($requestUrl, $expected): void { $options = array(); ProxyHelper::setRequestFullUri($requestUrl, $options); diff --git a/tests/Composer/Test/Util/Http/ProxyManagerTest.php b/tests/Composer/Test/Util/Http/ProxyManagerTest.php index 16d926039..6f40c08df 100644 --- a/tests/Composer/Test/Util/Http/ProxyManagerTest.php +++ b/tests/Composer/Test/Util/Http/ProxyManagerTest.php @@ -46,7 +46,7 @@ class ProxyManagerTest extends TestCase ProxyManager::reset(); } - public function testInstantiation() + public function testInstantiation(): void { $originalInstance = ProxyManager::getInstance(); $this->assertInstanceOf('Composer\Util\Http\ProxyManager', $originalInstance); @@ -59,7 +59,7 @@ class ProxyManagerTest extends TestCase $this->assertFalse($sameInstance === $newInstance); } - public function testGetProxyForRequestThrowsOnBadProxyUrl() + public function testGetProxyForRequestThrowsOnBadProxyUrl(): void { $_SERVER['http_proxy'] = 'localhost'; $proxyManager = ProxyManager::getInstance(); @@ -77,7 +77,7 @@ class ProxyManagerTest extends TestCase * @param bool $expectedSecure * @param string $expectedMessage */ - public function testGetProxyForRequest($server, $url, $expectedUrl, $expectedOptions, $expectedSecure, $expectedMessage) + public function testGetProxyForRequest($server, $url, $expectedUrl, $expectedOptions, $expectedSecure, $expectedMessage): void { $_SERVER = array_merge($_SERVER, $server); $proxyManager = ProxyManager::getInstance(); @@ -139,7 +139,7 @@ class ProxyManagerTest extends TestCase * @param bool $expectedStatus * @param string $expectedMessage */ - public function testGetStatus($server, $expectedStatus, $expectedMessage) + public function testGetStatus($server, $expectedStatus, $expectedMessage): void { $_SERVER = array_merge($_SERVER, $server); $proxyManager = ProxyManager::getInstance(); diff --git a/tests/Composer/Test/Util/Http/RequestProxyTest.php b/tests/Composer/Test/Util/Http/RequestProxyTest.php index 33f5664a8..8355e3d4e 100644 --- a/tests/Composer/Test/Util/Http/RequestProxyTest.php +++ b/tests/Composer/Test/Util/Http/RequestProxyTest.php @@ -23,7 +23,7 @@ class RequestProxyTest extends TestCase * @param string $url * @param bool $expectedSecure */ - public function testIsSecure($url, $expectedSecure) + public function testIsSecure($url, $expectedSecure): void { $proxy = new RequestProxy($url, array(), ''); @@ -47,7 +47,7 @@ class RequestProxyTest extends TestCase * @param string $format * @param string $expected */ - public function testGetFormattedUrlFormat($url, $format, $expected) + public function testGetFormattedUrlFormat($url, $format, $expected): void { $proxy = new RequestProxy($url, array(), $url); diff --git a/tests/Composer/Test/Util/HttpDownloaderTest.php b/tests/Composer/Test/Util/HttpDownloaderTest.php index e35ab514e..fe49c1ca5 100644 --- a/tests/Composer/Test/Util/HttpDownloaderTest.php +++ b/tests/Composer/Test/Util/HttpDownloaderTest.php @@ -38,7 +38,7 @@ class HttpDownloaderTest extends TestCase /** * @group slow */ - public function testCaptureAuthenticationParamsFromUrl() + public function testCaptureAuthenticationParamsFromUrl(): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io->expects($this->once()) @@ -53,7 +53,7 @@ class HttpDownloaderTest extends TestCase } } - public function testOutputWarnings() + public function testOutputWarnings(): void { $io = new BufferIO(); HttpDownloader::outputWarnings($io, '$URL', array()); diff --git a/tests/Composer/Test/Util/IniHelperTest.php b/tests/Composer/Test/Util/IniHelperTest.php index a6d83bb09..a3e8bc8e6 100644 --- a/tests/Composer/Test/Util/IniHelperTest.php +++ b/tests/Composer/Test/Util/IniHelperTest.php @@ -26,7 +26,7 @@ class IniHelperTest extends TestCase */ public static $envOriginal; - public function testWithNoIni() + public function testWithNoIni(): void { $paths = array( '', @@ -37,7 +37,7 @@ class IniHelperTest extends TestCase $this->assertEquals($paths, IniHelper::getAll()); } - public function testWithLoadedIniOnly() + public function testWithLoadedIniOnly(): void { $paths = array( 'loaded.ini', @@ -47,7 +47,7 @@ class IniHelperTest extends TestCase $this->assertStringContainsString('loaded.ini', IniHelper::getMessage()); } - public function testWithLoadedIniAndAdditional() + public function testWithLoadedIniAndAdditional(): void { $paths = array( 'loaded.ini', @@ -60,7 +60,7 @@ class IniHelperTest extends TestCase $this->assertEquals($paths, IniHelper::getAll()); } - public function testWithoutLoadedIniAndAdditional() + public function testWithoutLoadedIniAndAdditional(): void { $paths = array( '', @@ -96,7 +96,7 @@ class IniHelperTest extends TestCase * * @return void */ - protected function setEnv(array $paths) + protected function setEnv(array $paths): void { putenv('COMPOSER_ORIGINAL_INIS='.implode(PATH_SEPARATOR, $paths)); } diff --git a/tests/Composer/Test/Util/MetadataMinifierTest.php b/tests/Composer/Test/Util/MetadataMinifierTest.php index fa69e928d..44e28c9b2 100644 --- a/tests/Composer/Test/Util/MetadataMinifierTest.php +++ b/tests/Composer/Test/Util/MetadataMinifierTest.php @@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase; class MetadataMinifierTest extends TestCase { - public function testMinifyExpand() + public function testMinifyExpand(): void { $package1 = new CompletePackage('foo/bar', '2.0.0.0', '2.0.0'); $package1->setScripts(array('foo' => array('bar'))); diff --git a/tests/Composer/Test/Util/NoProxyPatternTest.php b/tests/Composer/Test/Util/NoProxyPatternTest.php index 940eff5cc..9a02d7e54 100644 --- a/tests/Composer/Test/Util/NoProxyPatternTest.php +++ b/tests/Composer/Test/Util/NoProxyPatternTest.php @@ -24,7 +24,7 @@ class NoProxyPatternTest extends TestCase * @param string $url * @param bool $expected */ - public function testHostName($noproxy, $url, $expected) + public function testHostName($noproxy, $url, $expected): void { $matcher = new NoProxyPattern($noproxy); $url = $this->getUrl($url); @@ -55,7 +55,7 @@ class NoProxyPatternTest extends TestCase * @param string $url * @param bool $expected */ - public function testIpAddress($noproxy, $url, $expected) + public function testIpAddress($noproxy, $url, $expected): void { $matcher = new NoProxyPattern($noproxy); $url = $this->getUrl($url); @@ -84,7 +84,7 @@ class NoProxyPatternTest extends TestCase * @param string $url * @param bool $expected */ - public function testIpRange($noproxy, $url, $expected) + public function testIpRange($noproxy, $url, $expected): void { $matcher = new NoProxyPattern($noproxy); $url = $this->getUrl($url); @@ -113,7 +113,7 @@ class NoProxyPatternTest extends TestCase * @param string $url * @param bool $expected */ - public function testPort($noproxy, $url, $expected) + public function testPort($noproxy, $url, $expected): void { $matcher = new NoProxyPattern($noproxy); $url = $this->getUrl($url); diff --git a/tests/Composer/Test/Util/PackageSorterTest.php b/tests/Composer/Test/Util/PackageSorterTest.php index 7ee94982c..e11d1b89f 100644 --- a/tests/Composer/Test/Util/PackageSorterTest.php +++ b/tests/Composer/Test/Util/PackageSorterTest.php @@ -20,7 +20,7 @@ use Composer\Semver\Constraint\MatchAllConstraint; class PackageSorterTest extends TestCase { - public function testSortingDoesNothingWithNoDependencies() + public function testSortingDoesNothingWithNoDependencies(): void { $packages[] = $this->createPackage('foo/bar1', array()); $packages[] = $this->createPackage('foo/bar2', array()); @@ -108,7 +108,7 @@ class PackageSorterTest extends TestCase * @param Package[] $packages * @param string[] $expectedOrderedList */ - public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList) + public function testSortingOrdersDependenciesHigherThanPackage($packages, $expectedOrderedList): void { $sortedPackages = PackageSorter::sortPackages($packages); $sortedPackageNames = array_map(function ($package) { diff --git a/tests/Composer/Test/Util/PerforceTest.php b/tests/Composer/Test/Util/PerforceTest.php index 817e4fe48..764d1a68c 100644 --- a/tests/Composer/Test/Util/PerforceTest.php +++ b/tests/Composer/Test/Util/PerforceTest.php @@ -73,12 +73,12 @@ class PerforceTest extends TestCase * * @return void */ - protected function createNewPerforceWithWindowsFlag($flag) + protected function createNewPerforceWithWindowsFlag($flag): void { $this->perforce = new Perforce($this->repoConfig, self::TEST_PORT, self::TEST_PATH, $this->processExecutor, $flag, $this->io); } - public function testGetClientWithoutStream() + public function testGetClientWithoutStream(): void { $client = $this->perforce->getClient(); @@ -86,7 +86,7 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $client); } - public function testGetClientFromStream() + public function testGetClientFromStream(): void { $this->setPerforceToStream(); @@ -96,13 +96,13 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $client); } - public function testGetStreamWithoutStream() + public function testGetStreamWithoutStream(): void { $stream = $this->perforce->getStream(); $this->assertEquals("//depot", $stream); } - public function testGetStreamWithStream() + public function testGetStreamWithStream(): void { $this->setPerforceToStream(); @@ -110,26 +110,26 @@ class PerforceTest extends TestCase $this->assertEquals('//depot/branch', $stream); } - public function testGetStreamWithoutLabelWithStreamWithoutLabel() + public function testGetStreamWithoutLabelWithStreamWithoutLabel(): void { $stream = $this->perforce->getStreamWithoutLabel('//depot/branch'); $this->assertEquals('//depot/branch', $stream); } - public function testGetStreamWithoutLabelWithStreamWithLabel() + public function testGetStreamWithoutLabelWithStreamWithLabel(): void { $stream = $this->perforce->getStreamWithoutLabel('//depot/branching@label'); $this->assertEquals('//depot/branching', $stream); } - public function testGetClientSpec() + public function testGetClientSpec(): void { $clientSpec = $this->perforce->getP4ClientSpec(); $expected = 'path/composer_perforce_TEST_depot.p4.spec'; $this->assertEquals($expected, $clientSpec); } - public function testGenerateP4Command() + public function testGenerateP4Command(): void { $command = 'do something'; $p4Command = $this->perforce->generateP4Command($command); @@ -137,13 +137,13 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $p4Command); } - public function testQueryP4UserWithUserAlreadySet() + public function testQueryP4UserWithUserAlreadySet(): void { $this->perforce->queryP4user(); $this->assertEquals(self::TEST_P4USER, $this->perforce->getUser()); } - public function testQueryP4UserWithUserSetInP4VariablesWithWindowsOS() + public function testQueryP4UserWithUserSetInP4VariablesWithWindowsOS(): void { $this->createNewPerforceWithWindowsFlag(true); $this->perforce->setUser(null); @@ -156,7 +156,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_P4VARIABLE_USER', $this->perforce->getUser()); } - public function testQueryP4UserWithUserSetInP4VariablesNotWindowsOS() + public function testQueryP4UserWithUserSetInP4VariablesNotWindowsOS(): void { $this->createNewPerforceWithWindowsFlag(false); $this->perforce->setUser(null); @@ -170,7 +170,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_P4VARIABLE_USER', $this->perforce->getUser()); } - public function testQueryP4UserQueriesForUser() + public function testQueryP4UserQueriesForUser(): void { $this->perforce->setUser(null); $expectedQuestion = 'Enter P4 User:'; @@ -181,7 +181,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_QUERY_USER', $this->perforce->getUser()); } - public function testQueryP4UserStoresResponseToQueryForUserWithWindows() + public function testQueryP4UserStoresResponseToQueryForUserWithWindows(): void { $this->createNewPerforceWithWindowsFlag(true); $this->perforce->setUser(null); @@ -203,7 +203,7 @@ class PerforceTest extends TestCase $this->perforce->queryP4user(); } - public function testQueryP4UserStoresResponseToQueryForUserWithoutWindows() + public function testQueryP4UserStoresResponseToQueryForUserWithoutWindows(): void { $this->createNewPerforceWithWindowsFlag(false); $this->perforce->setUser(null); @@ -223,7 +223,7 @@ class PerforceTest extends TestCase $this->perforce->queryP4user(); } - public function testQueryP4PasswordWithPasswordAlreadySet() + public function testQueryP4PasswordWithPasswordAlreadySet(): void { $repoConfig = array( 'depot' => 'depot', @@ -236,7 +236,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_PASSWORD', $password); } - public function testQueryP4PasswordWithPasswordSetInP4VariablesWithWindowsOS() + public function testQueryP4PasswordWithPasswordSetInP4VariablesWithWindowsOS(): void { $this->createNewPerforceWithWindowsFlag(true); @@ -249,7 +249,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_P4VARIABLE_PASSWORD', $password); } - public function testQueryP4PasswordWithPasswordSetInP4VariablesNotWindowsOS() + public function testQueryP4PasswordWithPasswordSetInP4VariablesNotWindowsOS(): void { $this->createNewPerforceWithWindowsFlag(false); @@ -262,7 +262,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_P4VARIABLE_PASSWORD', $password); } - public function testQueryP4PasswordQueriesForPassword() + public function testQueryP4PasswordQueriesForPassword(): void { $expectedQuestion = 'Enter password for Perforce user user: '; $this->io->expects($this->once()) @@ -274,7 +274,7 @@ class PerforceTest extends TestCase $this->assertEquals('TEST_QUERY_PASSWORD', $password); } - public function testWriteP4ClientSpecWithoutStream() + public function testWriteP4ClientSpecWithoutStream(): void { $stream = fopen('php://memory', 'w+'); if (false === $stream) { @@ -297,7 +297,7 @@ class PerforceTest extends TestCase fclose($stream); } - public function testWriteP4ClientSpecWithStream() + public function testWriteP4ClientSpecWithStream(): void { $this->setPerforceToStream(); $stream = fopen('php://memory', 'w+'); @@ -321,7 +321,7 @@ class PerforceTest extends TestCase fclose($stream); } - public function testIsLoggedIn() + public function testIsLoggedIn(): void { $this->processExecutor->expects( [['cmd' => 'p4 -u user -p port login -s']], @@ -330,7 +330,7 @@ class PerforceTest extends TestCase $this->perforce->isLoggedIn(); } - public function testConnectClient() + public function testConnectClient(): void { $this->processExecutor->expects( ['p4 -u user -c composer_perforce_TEST_depot -p port client -i < path/composer_perforce_TEST_depot.p4.spec'], @@ -340,7 +340,7 @@ class PerforceTest extends TestCase $this->perforce->connectClient(); } - public function testGetBranchesWithStream() + public function testGetBranchesWithStream(): void { $this->setPerforceToStream(); @@ -362,7 +362,7 @@ class PerforceTest extends TestCase $this->assertEquals('//depot/branch@1234', $branches['master']); } - public function testGetBranchesWithoutStream() + public function testGetBranchesWithoutStream(): void { $this->processExecutor->expects( [ @@ -378,7 +378,7 @@ class PerforceTest extends TestCase $this->assertEquals('//depot@5678', $branches['master']); } - public function testGetTagsWithoutStream() + public function testGetTagsWithoutStream(): void { $this->processExecutor->expects( [ @@ -395,7 +395,7 @@ class PerforceTest extends TestCase $this->assertEquals('//depot@0.0.2', $tags['0.0.2']); } - public function testGetTagsWithStream() + public function testGetTagsWithStream(): void { $this->setPerforceToStream(); @@ -414,14 +414,14 @@ class PerforceTest extends TestCase $this->assertEquals('//depot/branch@0.0.2', $tags['0.0.2']); } - public function testCheckStreamWithoutStream() + public function testCheckStreamWithoutStream(): void { $result = $this->perforce->checkStream(); $this->assertFalse($result); $this->assertFalse($this->perforce->isStream()); } - public function testCheckStreamWithStream() + public function testCheckStreamWithStream(): void { $this->processExecutor->expects( [ @@ -438,7 +438,7 @@ class PerforceTest extends TestCase $this->assertTrue($this->perforce->isStream()); } - public function testGetComposerInformationWithoutLabelWithoutStream() + public function testGetComposerInformationWithoutLabelWithoutStream(): void { $this->processExecutor->expects( [ @@ -460,7 +460,7 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $result); } - public function testGetComposerInformationWithLabelWithoutStream() + public function testGetComposerInformationWithLabelWithoutStream(): void { $this->processExecutor->expects( [ @@ -487,7 +487,7 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $result); } - public function testGetComposerInformationWithoutLabelWithStream() + public function testGetComposerInformationWithoutLabelWithStream(): void { $this->setPerforceToStream(); @@ -512,7 +512,7 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $result); } - public function testGetComposerInformationWithLabelWithStream() + public function testGetComposerInformationWithLabelWithStream(): void { $this->processExecutor->expects( [ @@ -541,7 +541,7 @@ class PerforceTest extends TestCase $this->assertEquals($expected, $result); } - public function testSyncCodeBaseWithoutStream() + public function testSyncCodeBaseWithoutStream(): void { $this->processExecutor->expects( ['p4 -u user -c composer_perforce_TEST_depot -p port sync -f @label'], @@ -551,7 +551,7 @@ class PerforceTest extends TestCase $this->perforce->syncCodeBase('label'); } - public function testSyncCodeBaseWithStream() + public function testSyncCodeBaseWithStream(): void { $this->setPerforceToStream(); @@ -563,7 +563,7 @@ class PerforceTest extends TestCase $this->perforce->syncCodeBase('label'); } - public function testCheckServerExists() + public function testCheckServerExists(): void { $this->processExecutor->expects( ['p4 -p '.ProcessExecutor::escape('perforce.does.exist:port').' info -s'], @@ -581,7 +581,7 @@ class PerforceTest extends TestCase * * @return void */ - public function testCheckServerClientError() + public function testCheckServerClientError(): void { $processExecutor = $this->getMockBuilder('Composer\Util\ProcessExecutor')->getMock(); @@ -650,12 +650,12 @@ class PerforceTest extends TestCase /** * @return void */ - private function setPerforceToStream() + private function setPerforceToStream(): void { $this->perforce->setStream('//depot/branch'); } - public function testCleanupClientSpecShouldDeleteClient() + public function testCleanupClientSpecShouldDeleteClient(): void { $fs = $this->getMockBuilder('Composer\Util\Filesystem')->getMock(); $this->perforce->setFilesystem($fs); diff --git a/tests/Composer/Test/Util/PlatformTest.php b/tests/Composer/Test/Util/PlatformTest.php index 70777d69a..f05d3a736 100644 --- a/tests/Composer/Test/Util/PlatformTest.php +++ b/tests/Composer/Test/Util/PlatformTest.php @@ -22,7 +22,7 @@ use Composer\Test\TestCase; */ class PlatformTest extends TestCase { - public function testExpandPath() + public function testExpandPath(): void { putenv('TESTENV=/home/test'); $this->assertEquals('/home/test/myPath', Platform::expandPath('%TESTENV%/myPath')); @@ -30,7 +30,7 @@ class PlatformTest extends TestCase $this->assertEquals((getenv('HOME') ?: getenv('USERPROFILE')) . '/test', Platform::expandPath('~/test')); } - public function testIsWindows() + public function testIsWindows(): void { // Compare 2 common tests for Windows to the built-in Windows test $this->assertEquals(('\\' === DIRECTORY_SEPARATOR), Platform::isWindows()); diff --git a/tests/Composer/Test/Util/ProcessExecutorTest.php b/tests/Composer/Test/Util/ProcessExecutorTest.php index ff2acd82e..7e57318ae 100644 --- a/tests/Composer/Test/Util/ProcessExecutorTest.php +++ b/tests/Composer/Test/Util/ProcessExecutorTest.php @@ -25,14 +25,14 @@ use Symfony\Component\Console\Output\StreamOutput; class ProcessExecutorTest extends TestCase { - public function testExecuteCapturesOutput() + public function testExecuteCapturesOutput(): void { $process = new ProcessExecutor; $process->execute('echo foo', $output); $this->assertEquals("foo".PHP_EOL, $output); } - public function testExecuteOutputsIfNotCaptured() + public function testExecuteOutputsIfNotCaptured(): void { $process = new ProcessExecutor; ob_start(); @@ -41,7 +41,7 @@ class ProcessExecutorTest extends TestCase $this->assertEquals("foo".PHP_EOL, $output); } - public function testUseIOIsNotNullAndIfNotCaptured() + public function testUseIOIsNotNullAndIfNotCaptured(): void { $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io->expects($this->once()) @@ -52,14 +52,14 @@ class ProcessExecutorTest extends TestCase $process->execute('echo foo'); } - public function testExecuteCapturesStderr() + public function testExecuteCapturesStderr(): void { $process = new ProcessExecutor; $process->execute('cat foo', $output); $this->assertNotNull($process->getErrorOutput()); } - public function testTimeout() + public function testTimeout(): void { ProcessExecutor::setTimeout(1); $process = new ProcessExecutor; @@ -73,7 +73,7 @@ class ProcessExecutorTest extends TestCase * @param string $command * @param string $expectedCommandOutput */ - public function testHidePasswords($command, $expectedCommandOutput) + public function testHidePasswords($command, $expectedCommandOutput): void { $process = new ProcessExecutor($buffer = new BufferIO('', StreamOutput::VERBOSITY_DEBUG)); $process->execute($command, $output); @@ -91,14 +91,14 @@ class ProcessExecutorTest extends TestCase ); } - public function testDoesntHidePorts() + public function testDoesntHidePorts(): void { $process = new ProcessExecutor($buffer = new BufferIO('', StreamOutput::VERBOSITY_DEBUG)); $process->execute('echo https://localhost:1234/', $output); $this->assertEquals('Executing command (CWD): echo https://localhost:1234/', trim($buffer->getOutput())); } - public function testSplitLines() + public function testSplitLines(): void { $process = new ProcessExecutor; $this->assertEquals(array(), $process->splitLines('')); @@ -109,7 +109,7 @@ class ProcessExecutorTest extends TestCase $this->assertEquals(array('foo', 'bar'), $process->splitLines("foo\r\nbar\n")); } - public function testConsoleIODoesNotFormatSymfonyConsoleStyle() + public function testConsoleIODoesNotFormatSymfonyConsoleStyle(): void { $output = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true); $process = new ProcessExecutor(new ConsoleIO(new ArrayInput(array()), $output, new HelperSet(array()))); @@ -118,7 +118,7 @@ class ProcessExecutorTest extends TestCase $this->assertSame('foo'.PHP_EOL, $output->fetch()); } - public function testExecuteAsyncCancel() + public function testExecuteAsyncCancel(): void { $process = new ProcessExecutor($buffer = new BufferIO('', StreamOutput::VERBOSITY_DEBUG)); $process->enableAsync(); @@ -141,7 +141,7 @@ class ProcessExecutorTest extends TestCase * @param string $win * @param string $unix */ - public function testEscapeArgument($argument, $win, $unix) + public function testEscapeArgument($argument, $win, $unix): void { $expected = defined('PHP_WINDOWS_VERSION_BUILD') ? $win : $unix; $this->assertSame($expected, ProcessExecutor::escape($argument)); diff --git a/tests/Composer/Test/Util/RemoteFilesystemTest.php b/tests/Composer/Test/Util/RemoteFilesystemTest.php index a63e24bb3..667e6d17f 100644 --- a/tests/Composer/Test/Util/RemoteFilesystemTest.php +++ b/tests/Composer/Test/Util/RemoteFilesystemTest.php @@ -24,7 +24,7 @@ use ReflectionProperty; class RemoteFilesystemTest extends TestCase { - public function testGetOptionsForUrl() + public function testGetOptionsForUrl(): void { $io = $this->getIOInterfaceMock(); $io @@ -37,7 +37,7 @@ class RemoteFilesystemTest extends TestCase $this->assertTrue(isset($res['http']['header']) && is_array($res['http']['header']), 'getOptions must return an array with headers'); } - public function testGetOptionsForUrlWithAuthorization() + public function testGetOptionsForUrlWithAuthorization(): void { $io = $this->getIOInterfaceMock(); $io @@ -62,7 +62,7 @@ class RemoteFilesystemTest extends TestCase $this->assertTrue($found, 'getOptions must have an Authorization header'); } - public function testGetOptionsForUrlWithStreamOptions() + public function testGetOptionsForUrlWithStreamOptions(): void { $io = $this->getIOInterfaceMock(); $io @@ -88,7 +88,7 @@ class RemoteFilesystemTest extends TestCase ); } - public function testGetOptionsForUrlWithCallOptionsKeepsHeader() + public function testGetOptionsForUrlWithCallOptionsKeepsHeader(): void { $io = $this->getIOInterfaceMock(); $io @@ -121,14 +121,14 @@ class RemoteFilesystemTest extends TestCase $this->assertGreaterThan(1, count($res['http']['header'])); } - public function testCallbackGetFileSize() + public function testCallbackGetFileSize(): void { $fs = new RemoteFilesystem($this->getIOInterfaceMock(), $this->getConfigMock()); $this->callCallbackGet($fs, STREAM_NOTIFY_FILE_SIZE_IS, 0, '', 0, 0, 20); $this->assertAttributeEqualsCustom(20, 'bytesMax', $fs); } - public function testCallbackGetNotifyProgress() + public function testCallbackGetNotifyProgress(): void { $io = $this->getIOInterfaceMock(); $io @@ -144,7 +144,7 @@ class RemoteFilesystemTest extends TestCase $this->assertAttributeEqualsCustom(50, 'lastProgress', $fs); } - public function testCallbackGetPassesThrough404() + public function testCallbackGetPassesThrough404(): void { $fs = new RemoteFilesystem($this->getIOInterfaceMock(), $this->getConfigMock()); @@ -152,14 +152,14 @@ class RemoteFilesystemTest extends TestCase $this->assertTrue(true, 'callbackGet must pass through 404'); } - public function testGetContents() + public function testGetContents(): void { $fs = new RemoteFilesystem($this->getIOInterfaceMock(), $this->getConfigMock()); $this->assertStringContainsString('testGetContents', $fs->getContents('http://example.org', 'file://'.__FILE__)); } - public function testCopy() + public function testCopy(): void { $fs = new RemoteFilesystem($this->getIOInterfaceMock(), $this->getConfigMock()); @@ -170,7 +170,7 @@ class RemoteFilesystemTest extends TestCase unlink($file); } - public function testCopyWithNoRetryOnFailure() + public function testCopyWithNoRetryOnFailure(): void { self::expectException('Composer\Downloader\TransportException'); $fs = $this->getRemoteFilesystemWithMockedMethods(array('getRemoteContents')); @@ -194,7 +194,7 @@ class RemoteFilesystemTest extends TestCase ); } - public function testCopyWithSuccessOnRetry() + public function testCopyWithSuccessOnRetry(): void { $authHelper = $this->getAuthHelperWithMockedMethods(array('promptAuthIfNeeded')); $fs = $this->getRemoteFilesystemWithMockedMethods(array('getRemoteContents'), $authHelper); @@ -241,7 +241,7 @@ class RemoteFilesystemTest extends TestCase /** * @group TLS */ - public function testGetOptionsForUrlCreatesSecureTlsDefaults() + public function testGetOptionsForUrlCreatesSecureTlsDefaults(): void { $io = $this->getIOInterfaceMock(); @@ -279,7 +279,7 @@ class RemoteFilesystemTest extends TestCase * @param string $contents * @dataProvider provideBitbucketPublicDownloadUrls */ - public function testBitBucketPublicDownload($url, $contents) + public function testBitBucketPublicDownload($url, $contents): void { /** @var ConsoleIO $io */ $io = $this @@ -302,7 +302,7 @@ class RemoteFilesystemTest extends TestCase * @param string $contents * @dataProvider provideBitbucketPublicDownloadUrls */ - public function testBitBucketPublicDownloadWithAuthConfigured($url, $contents) + public function testBitBucketPublicDownloadWithAuthConfigured($url, $contents): void { /** @var MockObject|ConsoleIO $io */ $io = $this @@ -385,7 +385,7 @@ class RemoteFilesystemTest extends TestCase * * @return void */ - private function callCallbackGet(RemoteFilesystem $fs, $notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax) + private function callCallbackGet(RemoteFilesystem $fs, $notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax): void { $ref = new ReflectionMethod($fs, 'callbackGet'); $ref->setAccessible(true); @@ -399,7 +399,7 @@ class RemoteFilesystemTest extends TestCase * * @return void */ - private function setAttribute($object, $attribute, $value) + private function setAttribute($object, $attribute, $value): void { $attr = new ReflectionProperty($object, $attribute); $attr->setAccessible(true); @@ -413,7 +413,7 @@ class RemoteFilesystemTest extends TestCase * * @return void */ - private function assertAttributeEqualsCustom($value, $attribute, $object) + private function assertAttributeEqualsCustom($value, $attribute, $object): void { $attr = new ReflectionProperty($object, $attribute); $attr->setAccessible(true); diff --git a/tests/Composer/Test/Util/SilencerTest.php b/tests/Composer/Test/Util/SilencerTest.php index 9072a7cda..58a81eb92 100644 --- a/tests/Composer/Test/Util/SilencerTest.php +++ b/tests/Composer/Test/Util/SilencerTest.php @@ -25,7 +25,7 @@ class SilencerTest extends TestCase /** * Test succeeds when no warnings are emitted externally, and original level is restored. */ - public function testSilencer() + public function testSilencer(): void { $before = error_reporting(); @@ -49,12 +49,12 @@ class SilencerTest extends TestCase /** * Test whether exception from silent callbacks are correctly forwarded. */ - public function testSilencedException() + public function testSilencedException(): void { $verification = microtime(); self::expectException('RuntimeException'); self::expectExceptionMessage($verification); - Silencer::call(function () use ($verification) { + Silencer::call(function () use ($verification): void { throw new \RuntimeException($verification); }); } diff --git a/tests/Composer/Test/Util/StreamContextFactoryTest.php b/tests/Composer/Test/Util/StreamContextFactoryTest.php index ca86d16ce..e5ae3ddca 100644 --- a/tests/Composer/Test/Util/StreamContextFactoryTest.php +++ b/tests/Composer/Test/Util/StreamContextFactoryTest.php @@ -39,7 +39,7 @@ class StreamContextFactoryTest extends TestCase * @param mixed[] $expectedParams * @param mixed[] $defaultParams */ - public function testGetContext($expectedOptions, $defaultOptions, $expectedParams, $defaultParams) + public function testGetContext($expectedOptions, $defaultOptions, $expectedParams, $defaultParams): void { $context = StreamContextFactory::getContext('http://example.org', $defaultOptions, $defaultParams); $options = stream_context_get_options($context); @@ -58,13 +58,13 @@ class StreamContextFactoryTest extends TestCase ), array( $a = array('http' => array('method' => 'GET', 'max_redirects' => 20, 'follow_location' => 1, 'header' => array('User-Agent: foo'))), array('http' => array('method' => 'GET', 'header' => 'User-Agent: foo')), - array('options' => $a, 'notification' => $f = function () { + array('options' => $a, 'notification' => $f = function (): void { }), array('notification' => $f), ), ); } - public function testHttpProxy() + public function testHttpProxy(): void { $_SERVER['http_proxy'] = 'http://username:p%40ssword@proxyserver.net:3128/'; $_SERVER['HTTP_PROXY'] = 'http://proxyserver/'; @@ -82,7 +82,7 @@ class StreamContextFactoryTest extends TestCase )), $options); } - public function testHttpProxyWithNoProxy() + public function testHttpProxyWithNoProxy(): void { $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/'; $_SERVER['no_proxy'] = 'foo,example.org'; @@ -98,7 +98,7 @@ class StreamContextFactoryTest extends TestCase )), $options); } - public function testHttpProxyWithNoProxyWildcard() + public function testHttpProxyWithNoProxyWildcard(): void { $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/'; $_SERVER['no_proxy'] = '*'; @@ -114,7 +114,7 @@ class StreamContextFactoryTest extends TestCase )), $options); } - public function testOptionsArePreserved() + public function testOptionsArePreserved(): void { $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/'; @@ -131,7 +131,7 @@ class StreamContextFactoryTest extends TestCase )), $options); } - public function testHttpProxyWithoutPort() + public function testHttpProxyWithoutPort(): void { $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net'; @@ -147,7 +147,7 @@ class StreamContextFactoryTest extends TestCase )), $options); } - public function testHttpsProxyOverride() + public function testHttpsProxyOverride(): void { if (!extension_loaded('openssl')) { $this->markTestSkipped('Requires openssl'); @@ -167,7 +167,7 @@ class StreamContextFactoryTest extends TestCase * @param string $expected * @param string $proxy */ - public function testSSLProxy($expected, $proxy) + public function testSSLProxy($expected, $proxy): void { $_SERVER['http_proxy'] = $proxy; @@ -200,7 +200,7 @@ class StreamContextFactoryTest extends TestCase ); } - public function testEnsureThatfixHttpHeaderFieldMovesContentTypeToEndOfOptions() + public function testEnsureThatfixHttpHeaderFieldMovesContentTypeToEndOfOptions(): void { $options = array( 'http' => array( @@ -222,7 +222,7 @@ class StreamContextFactoryTest extends TestCase $this->assertEquals(end($expectedOptions['http']['header']), end($ctxoptions['http']['header'])); } - public function testInitOptionsDoesIncludeProxyAuthHeaders() + public function testInitOptionsDoesIncludeProxyAuthHeaders(): void { $_SERVER['http_proxy'] = 'http://username:password@proxyserver.net:3128/'; @@ -233,7 +233,7 @@ class StreamContextFactoryTest extends TestCase $this->assertTrue(false !== stripos($headers, 'Proxy-Authorization')); } - public function testInitOptionsForCurlDoesNotIncludeProxyAuthHeaders() + public function testInitOptionsForCurlDoesNotIncludeProxyAuthHeaders(): void { if (!extension_loaded('curl')) { $this->markTestSkipped('The curl is not available.'); diff --git a/tests/Composer/Test/Util/SvnTest.php b/tests/Composer/Test/Util/SvnTest.php index 0ab43dd45..fce3081da 100644 --- a/tests/Composer/Test/Util/SvnTest.php +++ b/tests/Composer/Test/Util/SvnTest.php @@ -27,7 +27,7 @@ class SvnTest extends TestCase * * @dataProvider urlProvider */ - public function testCredentials($url, $expect) + public function testCredentials($url, $expect): void { $svn = new Svn($url, new NullIO, new Config()); $reflMethod = new \ReflectionMethod('Composer\\Util\\Svn', 'getCredentialString'); @@ -45,7 +45,7 @@ class SvnTest extends TestCase ); } - public function testInteractiveString() + public function testInteractiveString(): void { $url = 'http://svn.example.org'; @@ -59,7 +59,7 @@ class SvnTest extends TestCase ); } - public function testCredentialsFromConfig() + public function testCredentialsFromConfig(): void { $url = 'http://svn.apache.org'; @@ -79,7 +79,7 @@ class SvnTest extends TestCase $this->assertEquals($this->getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn)); } - public function testCredentialsFromConfigWithCacheCredentialsTrue() + public function testCredentialsFromConfigWithCacheCredentialsTrue(): void { $url = 'http://svn.apache.org'; @@ -102,7 +102,7 @@ class SvnTest extends TestCase $this->assertEquals($this->getCmd(" --username 'foo' --password 'bar' "), $reflMethod->invoke($svn)); } - public function testCredentialsFromConfigWithCacheCredentialsFalse() + public function testCredentialsFromConfigWithCacheCredentialsFalse(): void { $url = 'http://svn.apache.org'; diff --git a/tests/Composer/Test/Util/TarTest.php b/tests/Composer/Test/Util/TarTest.php index c15470071..b0e697819 100644 --- a/tests/Composer/Test/Util/TarTest.php +++ b/tests/Composer/Test/Util/TarTest.php @@ -20,44 +20,44 @@ use Composer\Test\TestCase; */ class TarTest extends TestCase { - public function testReturnsNullifTheTarIsNotFound() + public function testReturnsNullifTheTarIsNotFound(): void { $result = Tar::getComposerJson(__DIR__.'/Fixtures/Tar/invalid.zip'); $this->assertNull($result); } - public function testReturnsNullIfTheTarIsEmpty() + public function testReturnsNullIfTheTarIsEmpty(): void { $result = Tar::getComposerJson(__DIR__.'/Fixtures/Tar/empty.tar.gz'); $this->assertNull($result); } - public function testThrowsExceptionIfTheTarHasNoComposerJson() + public function testThrowsExceptionIfTheTarHasNoComposerJson(): void { self::expectException('RuntimeException'); Tar::getComposerJson(__DIR__.'/Fixtures/Tar/nojson.tar.gz'); } - public function testThrowsExceptionIfTheComposerJsonIsInASubSubfolder() + public function testThrowsExceptionIfTheComposerJsonIsInASubSubfolder(): void { self::expectException('RuntimeException'); Tar::getComposerJson(__DIR__.'/Fixtures/Tar/subfolders.tar.gz'); } - public function testReturnsComposerJsonInTarRoot() + public function testReturnsComposerJsonInTarRoot(): void { $result = Tar::getComposerJson(__DIR__.'/Fixtures/Tar/root.tar.gz'); $this->assertEquals("{\n \"name\": \"foo/bar\"\n}\n", $result); } - public function testReturnsComposerJsonInFirstFolder() + public function testReturnsComposerJsonInFirstFolder(): void { $result = Tar::getComposerJson(__DIR__.'/Fixtures/Tar/folder.tar.gz'); $this->assertEquals("{\n \"name\": \"foo/bar\"\n}\n", $result); } - public function testMultipleTopLevelDirsIsInvalid() + public function testMultipleTopLevelDirsIsInvalid(): void { self::expectException('RuntimeException'); Tar::getComposerJson(__DIR__.'/Fixtures/Tar/multiple.tar.gz'); diff --git a/tests/Composer/Test/Util/TlsHelperTest.php b/tests/Composer/Test/Util/TlsHelperTest.php index 3b9549951..35ded5266 100644 --- a/tests/Composer/Test/Util/TlsHelperTest.php +++ b/tests/Composer/Test/Util/TlsHelperTest.php @@ -24,7 +24,7 @@ class TlsHelperTest extends TestCase * @param string $hostname * @param string[] $certNames */ - public function testCheckCertificateHost($expectedResult, $hostname, $certNames) + public function testCheckCertificateHost($expectedResult, $hostname, $certNames): void { $certificate['subject']['commonName'] = $expectedCn = array_shift($certNames); $certificate['extensions']['subjectAltName'] = $certNames ? 'DNS:'.implode(',DNS:', $certNames) : ''; @@ -67,7 +67,7 @@ class TlsHelperTest extends TestCase ); } - public function testGetCertificateNames() + public function testGetCertificateNames(): void { $certificate['subject']['commonName'] = 'example.net'; $certificate['extensions']['subjectAltName'] = 'DNS: example.com, IP: 127.0.0.1, DNS: getcomposer.org, Junk: blah, DNS: composer.example.org'; diff --git a/tests/Composer/Test/Util/UrlTest.php b/tests/Composer/Test/Util/UrlTest.php index 66165b4b8..a935e8978 100644 --- a/tests/Composer/Test/Util/UrlTest.php +++ b/tests/Composer/Test/Util/UrlTest.php @@ -26,7 +26,7 @@ class UrlTest extends TestCase * @param array $conf * @param string $ref */ - public function testUpdateDistReference($url, $expectedUrl, $conf = array(), $ref = 'newref') + public function testUpdateDistReference($url, $expectedUrl, $conf = array(), $ref = 'newref'): void { $config = new Config(); $config->merge(array('config' => $conf)); @@ -70,7 +70,7 @@ class UrlTest extends TestCase * @param string $expected * @param string $url */ - public function testSanitize($expected, $url) + public function testSanitize($expected, $url): void { $this->assertSame($expected, Url::sanitize($url)); } diff --git a/tests/Composer/Test/Util/ZipTest.php b/tests/Composer/Test/Util/ZipTest.php index b55208c3e..fa92fd897 100644 --- a/tests/Composer/Test/Util/ZipTest.php +++ b/tests/Composer/Test/Util/ZipTest.php @@ -20,7 +20,7 @@ use Composer\Test\TestCase; */ class ZipTest extends TestCase { - public function testThrowsExceptionIfZipExtensionIsNotLoaded() + public function testThrowsExceptionIfZipExtensionIsNotLoaded(): void { if (extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is loaded.'); @@ -32,7 +32,7 @@ class ZipTest extends TestCase Zip::getComposerJson(''); } - public function testReturnsNullifTheZipIsNotFound() + public function testReturnsNullifTheZipIsNotFound(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -43,7 +43,7 @@ class ZipTest extends TestCase $this->assertNull($result); } - public function testReturnsNullIfTheZipIsEmpty() + public function testReturnsNullIfTheZipIsEmpty(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -54,7 +54,7 @@ class ZipTest extends TestCase $this->assertNull($result); } - public function testThrowsExceptionIfTheZipHasNoComposerJson() + public function testThrowsExceptionIfTheZipHasNoComposerJson(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -66,7 +66,7 @@ class ZipTest extends TestCase Zip::getComposerJson(__DIR__.'/Fixtures/Zip/nojson.zip'); } - public function testThrowsExceptionIfTheComposerJsonIsInASubSubfolder() + public function testThrowsExceptionIfTheComposerJsonIsInASubSubfolder(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -78,7 +78,7 @@ class ZipTest extends TestCase Zip::getComposerJson(__DIR__.'/Fixtures/Zip/subfolders.zip'); } - public function testReturnsComposerJsonInZipRoot() + public function testReturnsComposerJsonInZipRoot(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -89,7 +89,7 @@ class ZipTest extends TestCase $this->assertEquals("{\n \"name\": \"foo/bar\"\n}\n", $result); } - public function testReturnsComposerJsonInFirstFolder() + public function testReturnsComposerJsonInFirstFolder(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -99,7 +99,7 @@ class ZipTest extends TestCase $this->assertEquals("{\n \"name\": \"foo/bar\"\n}\n", $result); } - public function testMultipleTopLevelDirsIsInvalid() + public function testMultipleTopLevelDirsIsInvalid(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.'); @@ -111,7 +111,7 @@ class ZipTest extends TestCase Zip::getComposerJson(__DIR__.'/Fixtures/Zip/multiple.zip'); } - public function testReturnsComposerJsonFromFirstSubfolder() + public function testReturnsComposerJsonFromFirstSubfolder(): void { if (!extension_loaded('zip')) { $this->markTestSkipped('The PHP zip extension is not loaded.');