1
0
Fork 0

Add void types where no return statement is present

pull/10547/head
Jordi Boggiano 2022-02-18 10:38:54 +01:00
parent 32852304d0
commit abdc6893a6
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
213 changed files with 1129 additions and 1130 deletions

View File

@ -71,7 +71,6 @@ return $config->setRules([
'random_api_migration' => true, 'random_api_migration' => true,
'ternary_to_null_coalescing' => true, 'ternary_to_null_coalescing' => true,
//'declare_strict_types' => true, //'declare_strict_types' => true,
//'void_return' => true,
]) ])
->setUsingCache(true) ->setUsingCache(true)
->setRiskyAllowed(true) ->setRiskyAllowed(true)

View File

@ -38,7 +38,7 @@ class ClassMapGenerator
* @param string $file The name of the class map file * @param string $file The name of the class map file
* @return void * @return void
*/ */
public static function dump($dirs, $file) public static function dump($dirs, $file): void
{ {
$maps = array(); $maps = array();

View File

@ -51,7 +51,7 @@ class PhpFileCleaner
* @param string[] $types * @param string[] $types
* @return void * @return void
*/ */
public static function setTypeConfig($types) public static function setTypeConfig($types): void
{ {
foreach ($types as $type) { foreach ($types as $type) {
self::$typeConfig[$type[0]] = array( self::$typeConfig[$type[0]] = array(
@ -152,7 +152,7 @@ class PhpFileCleaner
/** /**
* @return void * @return void
*/ */
private function skipToPhp() private function skipToPhp(): void
{ {
while ($this->index < $this->len) { while ($this->index < $this->len) {
if ($this->contents[$this->index] === '<' && $this->peek('?')) { if ($this->contents[$this->index] === '<' && $this->peek('?')) {
@ -168,7 +168,7 @@ class PhpFileCleaner
* @param string $delimiter * @param string $delimiter
* @return void * @return void
*/ */
private function skipString($delimiter) private function skipString($delimiter): void
{ {
$this->index += 1; $this->index += 1;
while ($this->index < $this->len) { while ($this->index < $this->len) {
@ -187,7 +187,7 @@ class PhpFileCleaner
/** /**
* @return void * @return void
*/ */
private function skipComment() private function skipComment(): void
{ {
$this->index += 2; $this->index += 2;
while ($this->index < $this->len) { while ($this->index < $this->len) {
@ -203,7 +203,7 @@ class PhpFileCleaner
/** /**
* @return void * @return void
*/ */
private function skipToNewline() private function skipToNewline(): void
{ {
while ($this->index < $this->len) { while ($this->index < $this->len) {
if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") { if ($this->contents[$this->index] === "\r" || $this->contents[$this->index] === "\n") {
@ -217,7 +217,7 @@ class PhpFileCleaner
* @param string $delimiter * @param string $delimiter
* @return void * @return void
*/ */
private function skipHeredoc($delimiter) private function skipHeredoc($delimiter): void
{ {
$firstDelimiterChar = $delimiter[0]; $firstDelimiterChar = $delimiter[0];
$delimiterLength = \strlen($delimiter); $delimiterLength = \strlen($delimiter);

View File

@ -24,7 +24,7 @@ class AboutCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('about') ->setName('about')

View File

@ -41,7 +41,7 @@ class ArchiveCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('archive') ->setName('archive')

View File

@ -136,7 +136,7 @@ class BaseDependencyCommand extends BaseCommand
* *
* @return void * @return void
*/ */
protected function printTable(OutputInterface $output, $results) protected function printTable(OutputInterface $output, $results): void
{ {
$table = array(); $table = array();
$doubles = array(); $doubles = array();
@ -172,7 +172,7 @@ class BaseDependencyCommand extends BaseCommand
* *
* @return void * @return void
*/ */
protected function initStyles(OutputInterface $output) protected function initStyles(OutputInterface $output): void
{ {
$this->colors = array( $this->colors = array(
'green', 'green',
@ -197,7 +197,7 @@ class BaseDependencyCommand extends BaseCommand
* *
* @return void * @return void
*/ */
protected function printTree($results, $prefix = '', $level = 1) protected function printTree($results, $prefix = '', $level = 1): void
{ {
$count = count($results); $count = count($results);
$idx = 0; $idx = 0;
@ -223,7 +223,7 @@ class BaseDependencyCommand extends BaseCommand
* *
* @return void * @return void
*/ */
private function writeTreeLine($line) private function writeTreeLine($line): void
{ {
$io = $this->getIO(); $io = $this->getIO();
if (!$io->isDecorated()) { if (!$io->isDecorated()) {

View File

@ -26,7 +26,7 @@ class CheckPlatformReqsCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this->setName('check-platform-reqs') $this->setName('check-platform-reqs')
->setDescription('Check that platform requirements are satisfied.') ->setDescription('Check that platform requirements are satisfied.')
@ -174,7 +174,7 @@ EOT
* *
* @return void * @return void
*/ */
protected function printTable(OutputInterface $output, $results) protected function printTable(OutputInterface $output, $results): void
{ {
$rows = array(); $rows = array();
foreach ($results as $result) { foreach ($results as $result) {

View File

@ -25,7 +25,7 @@ class ClearCacheCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('clear-cache') ->setName('clear-cache')

View File

@ -62,7 +62,7 @@ class ConfigCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('config') ->setName('config')
@ -154,7 +154,7 @@ EOT
* @return void * @return void
* @throws \Exception * @throws \Exception
*/ */
protected function initialize(InputInterface $input, OutputInterface $output) protected function initialize(InputInterface $input, OutputInterface $output): void
{ {
parent::initialize($input, $output); parent::initialize($input, $output);
@ -810,7 +810,7 @@ EOT
* *
* @return void * @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; list($validator, $normalizer) = $callbacks;
if (1 !== count($values)) { if (1 !== count($values)) {
@ -845,7 +845,7 @@ EOT
* *
* @return void * @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; list($validator, $normalizer) = $callbacks;
if (true !== $validation = $validator($values)) { if (true !== $validation = $validator($values)) {
@ -868,7 +868,7 @@ EOT
* *
* @return void * @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; $origK = $k;
$io = $this->getIO(); $io = $this->getIO();

View File

@ -63,7 +63,7 @@ class CreateProjectCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('create-project') ->setName('create-project')
@ -443,7 +443,7 @@ EOT
@mkdir($directory, 0777, true); @mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) { if ($realDir = realpath($directory)) {
pcntl_async_signals(true); pcntl_async_signals(true);
pcntl_signal(SIGINT, function () use ($realDir) { pcntl_signal(SIGINT, function () use ($realDir): void {
$fs = new Filesystem(); $fs = new Filesystem();
$fs->removeDirectory($realDir); $fs->removeDirectory($realDir);
exit(130); exit(130);
@ -454,7 +454,7 @@ EOT
if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') { if (function_exists('sapi_windows_set_ctrl_handler') && PHP_SAPI === 'cli') {
@mkdir($directory, 0777, true); @mkdir($directory, 0777, true);
if ($realDir = realpath($directory)) { 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 = new Filesystem();
$fs->removeDirectory($realDir); $fs->removeDirectory($realDir);
exit(130); exit(130);

View File

@ -27,7 +27,7 @@ class DependsCommand extends BaseDependencyCommand
* *
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('depends') ->setName('depends')

View File

@ -33,7 +33,7 @@ class FundCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this->setName('fund') $this->setName('fund')
->setDescription('Discover how to help fund the maintenance of your dependencies.') ->setDescription('Discover how to help fund the maintenance of your dependencies.')

View File

@ -29,7 +29,7 @@ class GlobalCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('global') ->setName('global')

View File

@ -33,7 +33,7 @@ class HomeCommand extends BaseCommand
* *
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('browse') ->setName('browse')
@ -128,7 +128,7 @@ EOT
* @param string $url * @param string $url
* @return void * @return void
*/ */
private function openBrowser($url) private function openBrowser($url): void
{ {
$url = ProcessExecutor::escape($url); $url = ProcessExecutor::escape($url);

View File

@ -34,7 +34,7 @@ class LicensesCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('licenses') ->setName('licenses')

View File

@ -26,7 +26,7 @@ class OutdatedCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('outdated') ->setName('outdated')

View File

@ -27,7 +27,7 @@ class ProhibitsCommand extends BaseDependencyCommand
* *
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('prohibits') ->setName('prohibits')

View File

@ -35,7 +35,7 @@ class ReinstallCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('reinstall') ->setName('reinstall')

View File

@ -47,7 +47,7 @@ class RunScriptCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('run-script') ->setName('run-script')

View File

@ -42,7 +42,7 @@ class ScriptAliasCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName($this->script) ->setName($this->script)

View File

@ -33,7 +33,7 @@ class SearchCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('search') ->setName('search')

View File

@ -42,7 +42,7 @@ class SelfUpdateCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('self-update') ->setName('self-update')
@ -346,7 +346,7 @@ TAGSPUBKEY
* @return void * @return void
* @throws \Exception * @throws \Exception
*/ */
protected function fetchKeys(IOInterface $io, Config $config) protected function fetchKeys(IOInterface $io, Config $config): void
{ {
if (!$io->isInteractive()) { if (!$io->isInteractive()) {
throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively'); throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
@ -483,7 +483,7 @@ TAGSPUBKEY
* *
* @return void * @return void
*/ */
protected function cleanBackups($rollbackDir, $except = null) protected function cleanBackups($rollbackDir, $except = null): void
{ {
$finder = $this->getOldInstallationFinder($rollbackDir); $finder = $this->getOldInstallationFinder($rollbackDir);
$io = $this->getIO(); $io = $this->getIO();

View File

@ -40,7 +40,7 @@ class StatusCommand extends BaseCommand
* @return void * @return void
* @throws \Symfony\Component\Console\Exception\InvalidArgumentException * @throws \Symfony\Component\Console\Exception\InvalidArgumentException
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('status') ->setName('status')

View File

@ -26,7 +26,7 @@ class SuggestsCommand extends BaseCommand
/** /**
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('suggests') ->setName('suggests')

View File

@ -38,7 +38,7 @@ class ValidateCommand extends BaseCommand
* configure * configure
* @return void * @return void
*/ */
protected function configure() protected function configure(): void
{ {
$this $this
->setName('validate') ->setName('validate')
@ -169,7 +169,7 @@ EOT
* *
* @return void * @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; $doPrintSchemaUrl = false;

View File

@ -44,7 +44,7 @@ class Compiler
* *
* @throws \RuntimeException * @throws \RuntimeException
*/ */
public function compile($pharFile = 'composer.phar') public function compile($pharFile = 'composer.phar'): void
{ {
if (file_exists($pharFile)) { if (file_exists($pharFile)) {
unlink($pharFile); unlink($pharFile);
@ -217,7 +217,7 @@ class Compiler
* *
* @return void * @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); $path = $this->getRelativeFilePath($file);
$content = file_get_contents($file); $content = file_get_contents($file);
@ -245,7 +245,7 @@ class Compiler
/** /**
* @return void * @return void
*/ */
private function addComposerBin(\Phar $phar) private function addComposerBin(\Phar $phar): void
{ {
$content = file_get_contents(__DIR__.'/../../bin/composer'); $content = file_get_contents(__DIR__.'/../../bin/composer');
$content = Preg::replace('{^#!/usr/bin/env php\s*}', '', $content); $content = Preg::replace('{^#!/usr/bin/env php\s*}', '', $content);

View File

@ -144,7 +144,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setPackage(RootPackageInterface $package) public function setPackage(RootPackageInterface $package): void
{ {
$this->package = $package; $this->package = $package;
} }
@ -160,7 +160,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setConfig(Config $config) public function setConfig(Config $config): void
{ {
$this->config = $config; $this->config = $config;
} }
@ -176,7 +176,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setLocker(Locker $locker) public function setLocker(Locker $locker): void
{ {
$this->locker = $locker; $this->locker = $locker;
} }
@ -192,7 +192,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setLoop(Loop $loop) public function setLoop(Loop $loop): void
{ {
$this->loop = $loop; $this->loop = $loop;
} }
@ -208,7 +208,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setRepositoryManager(RepositoryManager $manager) public function setRepositoryManager(RepositoryManager $manager): void
{ {
$this->repositoryManager = $manager; $this->repositoryManager = $manager;
} }
@ -224,7 +224,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setDownloadManager(DownloadManager $manager) public function setDownloadManager(DownloadManager $manager): void
{ {
$this->downloadManager = $manager; $this->downloadManager = $manager;
} }
@ -240,7 +240,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setArchiveManager(ArchiveManager $manager) public function setArchiveManager(ArchiveManager $manager): void
{ {
$this->archiveManager = $manager; $this->archiveManager = $manager;
} }
@ -256,7 +256,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setInstallationManager(InstallationManager $manager) public function setInstallationManager(InstallationManager $manager): void
{ {
$this->installationManager = $manager; $this->installationManager = $manager;
} }
@ -272,7 +272,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setPluginManager(PluginManager $manager) public function setPluginManager(PluginManager $manager): void
{ {
$this->pluginManager = $manager; $this->pluginManager = $manager;
} }
@ -288,7 +288,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setEventDispatcher(EventDispatcher $eventDispatcher) public function setEventDispatcher(EventDispatcher $eventDispatcher): void
{ {
$this->eventDispatcher = $eventDispatcher; $this->eventDispatcher = $eventDispatcher;
} }
@ -304,7 +304,7 @@ class Composer
/** /**
* @return void * @return void
*/ */
public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator) public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator): void
{ {
$this->autoloadGenerator = $autoloadGenerator; $this->autoloadGenerator = $autoloadGenerator;
} }

View File

@ -140,7 +140,7 @@ class Config
/** /**
* @return void * @return void
*/ */
public function setConfigSource(ConfigSourceInterface $source) public function setConfigSource(ConfigSourceInterface $source): void
{ {
$this->configSource = $source; $this->configSource = $source;
} }
@ -156,7 +156,7 @@ class Config
/** /**
* @return void * @return void
*/ */
public function setAuthConfigSource(ConfigSourceInterface $source) public function setAuthConfigSource(ConfigSourceInterface $source): void
{ {
$this->authConfigSource = $source; $this->authConfigSource = $source;
} }
@ -177,7 +177,7 @@ class Config
* *
* @return void * @return void
*/ */
public function merge($config, $source = self::SOURCE_UNKNOWN) public function merge($config, $source = self::SOURCE_UNKNOWN): void
{ {
// override defaults with given config // override defaults with given config
if (!empty($config['config']) && is_array($config['config'])) { if (!empty($config['config']) && is_array($config['config'])) {
@ -471,7 +471,7 @@ class Config
* *
* @return void * @return void
*/ */
private function setSourceOfConfigValue($configValue, $path, $source) private function setSourceOfConfigValue($configValue, $path, $source): void
{ {
$this->sourceOfConfigValue[$path] = $source; $this->sourceOfConfigValue[$path] = $source;
@ -563,7 +563,7 @@ class Config
* *
* @return void * @return void
*/ */
private function disableRepoByName($name) private function disableRepoByName($name): void
{ {
if (isset($this->repositories[$name])) { if (isset($this->repositories[$name])) {
unset($this->repositories[$name]); unset($this->repositories[$name]);
@ -580,7 +580,7 @@ class Config
* *
* @return void * @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) // Return right away if the URL is malformed or custom (see issue #5173)
if (false === filter_var($url, FILTER_VALIDATE_URL)) { if (false === filter_var($url, FILTER_VALIDATE_URL)) {
@ -626,7 +626,7 @@ class Config
* *
* @return void * @return void
*/ */
public static function disableProcessTimeout() public static function disableProcessTimeout(): void
{ {
// Override global timeout set earlier by environment or config // Override global timeout set earlier by environment or config
ProcessExecutor::setTimeout(0); ProcessExecutor::setTimeout(0);

View File

@ -34,7 +34,7 @@ final class GithubActionError
* *
* @return void * @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')) { if (Platform::getEnv('GITHUB_ACTIONS') && !Platform::getEnv('COMPOSER_TESTS_ARE_RUNNING')) {
$message = $this->escapeData($message); $message = $this->escapeData($message);

View File

@ -43,7 +43,7 @@ class Decisions implements \Iterator, \Countable
* @param int $level * @param int $level
* @return void * @return void
*/ */
public function decide($literal, $level, Rule $why) public function decide($literal, $level, Rule $why): void
{ {
$this->addDecision($literal, $level); $this->addDecision($literal, $level);
$this->decisionQueue[] = array( $this->decisionQueue[] = array(
@ -177,7 +177,7 @@ class Decisions implements \Iterator, \Countable
/** /**
* @return void * @return void
*/ */
public function reset() public function reset(): void
{ {
while ($decision = array_pop($this->decisionQueue)) { while ($decision = array_pop($this->decisionQueue)) {
$this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0; $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
@ -188,7 +188,7 @@ class Decisions implements \Iterator, \Countable
* @param int $offset * @param int $offset
* @return void * @return void
*/ */
public function resetToOffset($offset) public function resetToOffset($offset): void
{ {
while (\count($this->decisionQueue) > $offset + 1) { while (\count($this->decisionQueue) > $offset + 1) {
$decision = array_pop($this->decisionQueue); $decision = array_pop($this->decisionQueue);
@ -199,7 +199,7 @@ class Decisions implements \Iterator, \Countable
/** /**
* @return void * @return void
*/ */
public function revertLast() public function revertLast(): void
{ {
$this->decisionMap[abs($this->lastLiteral())] = 0; $this->decisionMap[abs($this->lastLiteral())] = 0;
array_pop($this->decisionQueue); array_pop($this->decisionQueue);
@ -252,7 +252,7 @@ class Decisions implements \Iterator, \Countable
* @param int $level * @param int $level
* @return void * @return void
*/ */
protected function addDecision($literal, $level) protected function addDecision($literal, $level): void
{ {
$packageId = abs($literal); $packageId = abs($literal);

View File

@ -62,7 +62,7 @@ class LockTransaction extends Transaction
/** /**
* @return void * @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()); $this->resultPackages = array('all' => array(), 'non-dev' => array(), 'dev' => array());
foreach ($decisions as $i => $decision) { foreach ($decisions as $i => $decision) {
@ -82,7 +82,7 @@ class LockTransaction extends Transaction
/** /**
* @return void * @return void
*/ */
public function setNonDevPackages(LockTransaction $extractionResult) public function setNonDevPackages(LockTransaction $extractionResult): void
{ {
$packages = $extractionResult->getNewLockPackages(false); $packages = $extractionResult->getNewLockPackages(false);

View File

@ -86,7 +86,7 @@ class MultiConflictRule extends Rule
* @return never * @return never
* @throws \RuntimeException * @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."); 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.");
} }

View File

@ -93,7 +93,7 @@ class Pool implements \Countable
* @param BasePackage[] $packages * @param BasePackage[] $packages
* @return void * @return void
*/ */
private function setPackages(array $packages) private function setPackages(array $packages): void
{ {
$id = 1; $id = 1;

View File

@ -298,7 +298,7 @@ class PoolBuilder
* @param string $name * @param string $name
* @return void * @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 // Skip platform requires at this stage
if (PlatformRepository::isPlatformPackage($name)) { if (PlatformRepository::isPlatformPackage($name)) {
@ -357,7 +357,7 @@ class PoolBuilder
* @param RepositoryInterface[] $repositories * @param RepositoryInterface[] $repositories
* @return void * @return void
*/ */
private function loadPackagesMarkedForLoading(Request $request, array $repositories) private function loadPackagesMarkedForLoading(Request $request, array $repositories): void
{ {
foreach ($this->packagesToLoad as $name => $constraint) { foreach ($this->packagesToLoad as $name => $constraint) {
$this->loadedPackages[$name] = $constraint; $this->loadedPackages[$name] = $constraint;
@ -394,7 +394,7 @@ class PoolBuilder
* @param RepositoryInterface[] $repositories * @param RepositoryInterface[] $repositories
* @return void * @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++; $index = $this->indexCounter++;
$this->packages[$index] = $package; $this->packages[$index] = $package;
@ -568,7 +568,7 @@ class PoolBuilder
/** /**
* @return void * @return void
*/ */
private function warnAboutNonMatchingUpdateAllowList(Request $request) private function warnAboutNonMatchingUpdateAllowList(Request $request): void
{ {
foreach ($this->updateAllowList as $pattern => $void) { foreach ($this->updateAllowList as $pattern => $void) {
$patternRegexp = BasePackage::packageNameToRegexp($pattern); $patternRegexp = BasePackage::packageNameToRegexp($pattern);
@ -600,7 +600,7 @@ class PoolBuilder
* @param string $name * @param string $name
* @return void * @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) { foreach ($this->skippedLoad[$name] as $packageOrReplacer) {
// if we unfixed a replaced package name, we also need to unfix the replacer itself // if we unfixed a replaced package name, we also need to unfix the replacer itself
@ -666,7 +666,7 @@ class PoolBuilder
* @param int $index * @param int $index
* @return void * @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); $repoIndex = array_search($package->getRepository(), $repositories, true);

View File

@ -99,7 +99,7 @@ class PoolOptimizer
/** /**
* @return void * @return void
*/ */
private function prepare(Request $request, Pool $pool) private function prepare(Request $request, Pool $pool): void
{ {
$irremovablePackageConstraintGroups = array(); $irremovablePackageConstraintGroups = array();
@ -155,7 +155,7 @@ class PoolOptimizer
/** /**
* @return void * @return void
*/ */
private function markPackageIrremovable(BasePackage $package) private function markPackageIrremovable(BasePackage $package): void
{ {
$this->irremovablePackages[$package->id] = true; $this->irremovablePackages[$package->id] = true;
if ($package instanceof AliasPackage) { if ($package instanceof AliasPackage) {
@ -193,7 +193,7 @@ class PoolOptimizer
/** /**
* @return void * @return void
*/ */
private function optimizeByIdenticalDependencies(Request $request, Pool $pool) private function optimizeByIdenticalDependencies(Request $request, Pool $pool): void
{ {
$identicalDefinitionsPerPackage = array(); $identicalDefinitionsPerPackage = array();
$packageIdenticalDefinitionLookup = array(); $packageIdenticalDefinitionLookup = array();
@ -322,7 +322,7 @@ class PoolOptimizer
* @param int $id * @param int $id
* @return void * @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 // We are not allowed to remove packages if they have been marked as irremovable
if (isset($this->irremovablePackages[$id])) { if (isset($this->irremovablePackages[$id])) {
@ -337,7 +337,7 @@ class PoolOptimizer
* @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup * @param array<int, array<string, array{groupHash: string, dependencyHash: string}>> $packageIdenticalDefinitionLookup
* @return void * @return void
*/ */
private function keepPackage(BasePackage $package, $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup) private function keepPackage(BasePackage $package, $identicalDefinitionsPerPackage, $packageIdenticalDefinitionLookup): void
{ {
unset($this->packagesToRemove[$package->id]); unset($this->packagesToRemove[$package->id]);
@ -389,7 +389,7 @@ class PoolOptimizer
* *
* @return void * @return void
*/ */
private function optimizeImpossiblePackagesAway(Request $request, Pool $pool) private function optimizeImpossiblePackagesAway(Request $request, Pool $pool): void
{ {
if (count($request->getLockedPackages()) === 0) { if (count($request->getLockedPackages()) === 0) {
return; return;

View File

@ -64,7 +64,7 @@ class Request
* @param string $packageName * @param string $packageName
* @return void * @return void
*/ */
public function requireName($packageName, ConstraintInterface $constraint = null) public function requireName($packageName, ConstraintInterface $constraint = null): void
{ {
$packageName = strtolower($packageName); $packageName = strtolower($packageName);
@ -85,7 +85,7 @@ class Request
* *
* @return void * @return void
*/ */
public function fixPackage(BasePackage $package) public function fixPackage(BasePackage $package): void
{ {
$this->fixedPackages[spl_object_hash($package)] = $package; $this->fixedPackages[spl_object_hash($package)] = $package;
} }
@ -102,7 +102,7 @@ class Request
* *
* @return void * @return void
*/ */
public function lockPackage(BasePackage $package) public function lockPackage(BasePackage $package): void
{ {
$this->lockedPackages[spl_object_hash($package)] = $package; $this->lockedPackages[spl_object_hash($package)] = $package;
} }
@ -116,7 +116,7 @@ class Request
* *
* @return void * @return void
*/ */
public function fixLockedPackage(BasePackage $package) public function fixLockedPackage(BasePackage $package): void
{ {
$this->fixedPackages[spl_object_hash($package)] = $package; $this->fixedPackages[spl_object_hash($package)] = $package;
$this->fixedLockedPackages[spl_object_hash($package)] = $package; $this->fixedLockedPackages[spl_object_hash($package)] = $package;
@ -125,7 +125,7 @@ class Request
/** /**
* @return void * @return void
*/ */
public function unlockPackage(BasePackage $package) public function unlockPackage(BasePackage $package): void
{ {
unset($this->lockedPackages[spl_object_hash($package)]); unset($this->lockedPackages[spl_object_hash($package)]);
} }
@ -135,7 +135,7 @@ class Request
* @param false|self::UPDATE_* $updateAllowTransitiveDependencies * @param false|self::UPDATE_* $updateAllowTransitiveDependencies
* @return void * @return void
*/ */
public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies) public function setUpdateAllowList($updateAllowList, $updateAllowTransitiveDependencies): void
{ {
$this->updateAllowList = $updateAllowList; $this->updateAllowList = $updateAllowList;
$this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies; $this->updateAllowTransitiveDependencies = $updateAllowTransitiveDependencies;

View File

@ -128,7 +128,7 @@ abstract class Rule
* @param RuleSet::TYPE_* $type * @param RuleSet::TYPE_* $type
* @return void * @return void
*/ */
public function setType($type) public function setType($type): void
{ {
$this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE); $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
} }
@ -144,7 +144,7 @@ abstract class Rule
/** /**
* @return void * @return void
*/ */
public function disable() public function disable(): void
{ {
$this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED); $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
} }
@ -152,7 +152,7 @@ abstract class Rule
/** /**
* @return void * @return void
*/ */
public function enable() public function enable(): void
{ {
$this->bitfield &= ~(255 << self::BITFIELD_DISABLED); $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
} }

View File

@ -59,7 +59,7 @@ class RuleSet implements \IteratorAggregate, \Countable
* @param self::TYPE_* $type * @param self::TYPE_* $type
* @return void * @return void
*/ */
public function add(Rule $rule, $type) public function add(Rule $rule, $type): void
{ {
if (!isset(self::$types[$type])) { if (!isset(self::$types[$type])) {
throw new \OutOfBoundsException('Unknown rule type: ' . $type); throw new \OutOfBoundsException('Unknown rule type: ' . $type);

View File

@ -152,7 +152,7 @@ class RuleSetGenerator
* *
* @return void * @return void
*/ */
private function addRule($type, Rule $newRule = null) private function addRule($type, Rule $newRule = null): void
{ {
if (!$newRule) { if (!$newRule) {
return; return;
@ -164,7 +164,7 @@ class RuleSetGenerator
/** /**
* @return void * @return void
*/ */
protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter) protected function addRulesForPackage(BasePackage $package, PlatformRequirementFilterInterface $platformRequirementFilter): void
{ {
/** @var \SplQueue<BasePackage> */ /** @var \SplQueue<BasePackage> */
$workQueue = new \SplQueue; $workQueue = new \SplQueue;
@ -218,7 +218,7 @@ class RuleSetGenerator
/** /**
* @return void * @return void
*/ */
protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter) protected function addConflictRules(PlatformRequirementFilterInterface $platformRequirementFilter): void
{ {
/** @var BasePackage $package */ /** @var BasePackage $package */
foreach ($this->addedMap as $package) { foreach ($this->addedMap as $package) {
@ -259,7 +259,7 @@ class RuleSetGenerator
/** /**
* @return void * @return void
*/ */
protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter) protected function addRulesForRequest(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
{ {
foreach ($request->getFixedPackages() as $package) { foreach ($request->getFixedPackages() as $package) {
if ($package->id == -1) { if ($package->id == -1) {
@ -305,7 +305,7 @@ class RuleSetGenerator
/** /**
* @return void * @return void
*/ */
protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter) protected function addRulesForRootAliases(PlatformRequirementFilterInterface $platformRequirementFilter): void
{ {
foreach ($this->pool->getPackages() as $package) { foreach ($this->pool->getPackages() as $package) {
// ensure that rules for root alias packages and aliases of packages which were loaded are also loaded // ensure that rules for root alias packages and aliases of packages which were loaded are also loaded

View File

@ -29,7 +29,7 @@ class RuleWatchChain extends \SplDoublyLinkedList
* @param int $offset The offset to seek to. * @param int $offset The offset to seek to.
* @return void * @return void
*/ */
public function seek($offset) public function seek($offset): void
{ {
$this->rewind(); $this->rewind();
for ($i = 0; $i < $offset; $i++, $this->next()); for ($i = 0; $i < $offset; $i++, $this->next());
@ -45,7 +45,7 @@ class RuleWatchChain extends \SplDoublyLinkedList
* *
* @return void * @return void
*/ */
public function remove() public function remove(): void
{ {
$offset = $this->key(); $offset = $this->key();
$this->offsetUnset($offset); $this->offsetUnset($offset);

View File

@ -40,7 +40,7 @@ class RuleWatchGraph
* @param RuleWatchNode $node The rule node to be inserted into the graph * @param RuleWatchNode $node The rule node to be inserted into the graph
* @return void * @return void
*/ */
public function insert(RuleWatchNode $node) public function insert(RuleWatchNode $node): void
{ {
if ($node->getRule()->isAssertion()) { if ($node->getRule()->isAssertion()) {
return; return;
@ -156,7 +156,7 @@ class RuleWatchGraph
* @param RuleWatchNode $node The rule node to be moved * @param RuleWatchNode $node The rule node to be moved
* @return void * @return void
*/ */
protected function moveWatch($fromLiteral, $toLiteral, RuleWatchNode $node) protected function moveWatch($fromLiteral, $toLiteral, RuleWatchNode $node): void
{ {
if (!isset($this->watchChains[$toLiteral])) { if (!isset($this->watchChains[$toLiteral])) {
$this->watchChains[$toLiteral] = new RuleWatchChain; $this->watchChains[$toLiteral] = new RuleWatchChain;

View File

@ -54,7 +54,7 @@ class RuleWatchNode
* @param Decisions $decisions The decisions made so far by the solver * @param Decisions $decisions The decisions made so far by the solver
* @return void * @return void
*/ */
public function watch2OnHighest(Decisions $decisions) public function watch2OnHighest(Decisions $decisions): void
{ {
$literals = $this->rule->getLiterals(); $literals = $this->rule->getLiterals();
@ -107,7 +107,7 @@ class RuleWatchNode
* @param int $to The literal to be watched now * @param int $to The literal to be watched now
* @return void * @return void
*/ */
public function moveWatch($from, $to) public function moveWatch($from, $to): void
{ {
if ($this->watch1 == $from) { if ($this->watch1 == $from) {
$this->watch1 = $to; $this->watch1 = $to;

View File

@ -86,7 +86,7 @@ class Solver
/** /**
* @return void * @return void
*/ */
private function makeAssertionRuleDecisions() private function makeAssertionRuleDecisions(): void
{ {
$decisionStart = \count($this->decisions) - 1; $decisionStart = \count($this->decisions) - 1;
@ -159,7 +159,7 @@ class Solver
/** /**
* @return void * @return void
*/ */
protected function setupFixedMap(Request $request) protected function setupFixedMap(Request $request): void
{ {
$this->fixedMap = array(); $this->fixedMap = array();
foreach ($request->getFixedPackages() as $package) { foreach ($request->getFixedPackages() as $package) {
@ -170,7 +170,7 @@ class Solver
/** /**
* @return void * @return void
*/ */
protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter) protected function checkForRootRequireProblems(Request $request, PlatformRequirementFilterInterface $platformRequirementFilter): void
{ {
foreach ($request->getRequires() as $packageName => $constraint) { foreach ($request->getRequires() as $packageName => $constraint) {
if ($platformRequirementFilter->isIgnored($packageName)) { if ($platformRequirementFilter->isIgnored($packageName)) {
@ -261,7 +261,7 @@ class Solver
* *
* @return void * @return void
*/ */
private function revert($level) private function revert($level): void
{ {
while (!$this->decisions->isEmpty()) { while (!$this->decisions->isEmpty()) {
$literal = $this->decisions->lastLiteral(); $literal = $this->decisions->lastLiteral();
@ -518,7 +518,7 @@ class Solver
* @param array<string, true> $ruleSeen * @param array<string, true> $ruleSeen
* @return void * @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); $why = spl_object_hash($conflictRule);
$ruleSeen[$why] = true; $ruleSeen[$why] = true;
@ -606,7 +606,7 @@ class Solver
* *
* @return void * @return void
*/ */
private function enableDisableLearnedRules() private function enableDisableLearnedRules(): void
{ {
foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) { foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
$why = $this->learnedWhy[spl_object_hash($rule)]; $why = $this->learnedWhy[spl_object_hash($rule)];
@ -631,7 +631,7 @@ class Solver
/** /**
* @return void * @return void
*/ */
private function runSat() private function runSat(): void
{ {
$this->propagateIndex = 0; $this->propagateIndex = 0;

View File

@ -69,7 +69,7 @@ class Transaction
* @param PackageInterface[] $resultPackages * @param PackageInterface[] $resultPackages
* @return void * @return void
*/ */
private function setResultPackageMaps($resultPackages) private function setResultPackageMaps($resultPackages): void
{ {
$packageSort = function (PackageInterface $a, PackageInterface $b) { $packageSort = function (PackageInterface $a, PackageInterface $b) {
// sort alias packages by the same name behind their non alias version // sort alias packages by the same name behind their non alias version

View File

@ -59,7 +59,7 @@ class GzipDownloader extends ArchiveDownloader
* *
* @return void * @return void
*/ */
private function extractUsingExt($file, $targetFilepath) private function extractUsingExt($file, $targetFilepath): void
{ {
$archiveFile = gzopen($file, 'rb'); $archiveFile = gzopen($file, 'rb');
$targetFile = fopen($targetFilepath, 'wb'); $targetFile = fopen($targetFilepath, 'wb');

View File

@ -73,7 +73,7 @@ class PerforceDownloader extends VcsDownloader
* *
* @return void * @return void
*/ */
public function initPerforce(PackageInterface $package, $path, $url) public function initPerforce(PackageInterface $package, $path, $url): void
{ {
if (!empty($this->perforce)) { if (!empty($this->perforce)) {
$this->perforce->initializePath($path); $this->perforce->initializePath($path);
@ -126,7 +126,7 @@ class PerforceDownloader extends VcsDownloader
/** /**
* @return void * @return void
*/ */
public function setPerforce(Perforce $perforce) public function setPerforce(Perforce $perforce): void
{ {
$this->perforce = $perforce; $this->perforce = $perforce;
} }

View File

@ -31,7 +31,7 @@ class TransportException extends \RuntimeException
* *
* @return void * @return void
*/ */
public function setHeaders($headers) public function setHeaders($headers): void
{ {
$this->headers = $headers; $this->headers = $headers;
} }
@ -49,7 +49,7 @@ class TransportException extends \RuntimeException
* *
* @return void * @return void
*/ */
public function setResponse($response) public function setResponse($response): void
{ {
$this->response = $response; $this->response = $response;
} }
@ -67,7 +67,7 @@ class TransportException extends \RuntimeException
* *
* @return void * @return void
*/ */
public function setStatusCode($statusCode) public function setStatusCode($statusCode): void
{ {
$this->statusCode = $statusCode; $this->statusCode = $statusCode;
} }
@ -93,7 +93,7 @@ class TransportException extends \RuntimeException
* *
* @return void * @return void
*/ */
public function setResponseInfo(array $responseInfo) public function setResponseInfo(array $responseInfo): void
{ {
$this->responseInfo = $responseInfo; $this->responseInfo = $responseInfo;
} }

View File

@ -77,7 +77,7 @@ class BufferIO extends ConsoleIO
* *
* @return void * @return void
*/ */
public function setUserInputs(array $inputs) public function setUserInputs(array $inputs): void
{ {
if (!$this->input instanceof StreamableInputInterface) { if (!$this->input instanceof StreamableInputInterface) {
throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.'); throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');

View File

@ -62,28 +62,28 @@ class NullIO extends BaseIO
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function write($messages, $newline = true, $verbosity = self::NORMAL) public function write($messages, $newline = true, $verbosity = self::NORMAL): void
{ {
} }
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function writeError($messages, $newline = true, $verbosity = self::NORMAL) public function writeError($messages, $newline = true, $verbosity = self::NORMAL): void
{ {
} }
/** /**
* @inheritDoc * @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 * @inheritDoc
*/ */
public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL) public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL): void
{ {
} }

View File

@ -919,7 +919,7 @@ class Installer
* *
* @return void * @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 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) { if ($this->updateMirrors) {
@ -988,7 +988,7 @@ class Installer
* *
* @return void * @return void
*/ */
private function mockLocalRepositories(RepositoryManager $rm) private function mockLocalRepositories(RepositoryManager $rm): void
{ {
$packages = array(); $packages = array();
foreach ($rm->getLocalRepository()->getPackages() as $package) { foreach ($rm->getLocalRepository()->getPackages() as $package) {

View File

@ -62,7 +62,7 @@ class BinaryInstaller
* *
* @return void * @return void
*/ */
public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true) public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true): void
{ {
$binaries = $this->getBinaries($package); $binaries = $this->getBinaries($package);
if (!$binaries) { if (!$binaries) {
@ -120,7 +120,7 @@ class BinaryInstaller
/** /**
* @return void * @return void
*/ */
public function removeBinaries(PackageInterface $package) public function removeBinaries(PackageInterface $package): void
{ {
$this->initializeBinDir(); $this->initializeBinDir();
@ -180,7 +180,7 @@ class BinaryInstaller
* *
* @return void * @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 // add unixy support for cygwin and similar environments
if ('.bat' !== substr($binPath, -4)) { if ('.bat' !== substr($binPath, -4)) {
@ -202,7 +202,7 @@ class BinaryInstaller
* *
* @return void * @return void
*/ */
protected function installUnixyProxyBinaries($binPath, $link) protected function installUnixyProxyBinaries($binPath, $link): void
{ {
file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link)); file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
Silencer::call('chmod', $link, 0777 & ~umask()); Silencer::call('chmod', $link, 0777 & ~umask());
@ -211,7 +211,7 @@ class BinaryInstaller
/** /**
* @return void * @return void
*/ */
protected function initializeBinDir() protected function initializeBinDir(): void
{ {
$this->filesystem->ensureDirectoryExists($this->binDir); $this->filesystem->ensureDirectoryExists($this->binDir);
$this->binDir = realpath($this->binDir); $this->binDir = realpath($this->binDir);

View File

@ -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 * @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 * @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); $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 * @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 * @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); $suggestedPackages = $this->getFilteredSuggestions($installedRepo, $onlyDependentsOf);
if ($suggestedPackages) { if ($suggestedPackages) {

View File

@ -249,7 +249,7 @@ class AliasPackage extends BasePackage
return $this->aliasOf->getExtra(); return $this->aliasOf->getExtra();
} }
public function setInstallationSource($type) public function setInstallationSource($type): void
{ {
$this->aliasOf->setInstallationSource($type); $this->aliasOf->setInstallationSource($type);
} }
@ -279,12 +279,12 @@ class AliasPackage extends BasePackage
return $this->aliasOf->getSourceReference(); return $this->aliasOf->getSourceReference();
} }
public function setSourceReference($reference) public function setSourceReference($reference): void
{ {
$this->aliasOf->setSourceReference($reference); $this->aliasOf->setSourceReference($reference);
} }
public function setSourceMirrors($mirrors) public function setSourceMirrors($mirrors): void
{ {
$this->aliasOf->setSourceMirrors($mirrors); $this->aliasOf->setSourceMirrors($mirrors);
} }
@ -314,7 +314,7 @@ class AliasPackage extends BasePackage
return $this->aliasOf->getDistReference(); return $this->aliasOf->getDistReference();
} }
public function setDistReference($reference) public function setDistReference($reference): void
{ {
$this->aliasOf->setDistReference($reference); $this->aliasOf->setDistReference($reference);
} }
@ -324,7 +324,7 @@ class AliasPackage extends BasePackage
return $this->aliasOf->getDistSha1Checksum(); return $this->aliasOf->getDistSha1Checksum();
} }
public function setTransportOptions(array $options) public function setTransportOptions(array $options): void
{ {
$this->aliasOf->setTransportOptions($options); $this->aliasOf->setTransportOptions($options);
} }
@ -334,7 +334,7 @@ class AliasPackage extends BasePackage
return $this->aliasOf->getTransportOptions(); return $this->aliasOf->getTransportOptions();
} }
public function setDistMirrors($mirrors) public function setDistMirrors($mirrors): void
{ {
$this->aliasOf->setDistMirrors($mirrors); $this->aliasOf->setDistMirrors($mirrors);
} }
@ -384,17 +384,17 @@ class AliasPackage extends BasePackage
return $this->aliasOf->isDefaultBranch(); return $this->aliasOf->isDefaultBranch();
} }
public function setDistUrl($url) public function setDistUrl($url): void
{ {
$this->aliasOf->setDistUrl($url); $this->aliasOf->setDistUrl($url);
} }
public function setDistType($type) public function setDistType($type): void
{ {
$this->aliasOf->setDistType($type); $this->aliasOf->setDistType($type);
} }
public function setSourceDistReferences($reference) public function setSourceDistReferences($reference): void
{ {
$this->aliasOf->setSourceDistReferences($reference); $this->aliasOf->setSourceDistReferences($reference);
} }

View File

@ -40,7 +40,7 @@ class ArchivableFilesFilter extends FilterIterator
* *
* @return void * @return void
*/ */
public function addEmptyDir(PharData $phar, $sources) public function addEmptyDir(PharData $phar, $sources): void
{ {
foreach ($this->dirs as $filepath) { foreach ($this->dirs as $filepath) {
$localname = str_replace($sources . "/", '', $filepath); $localname = str_replace($sources . "/", '', $filepath);

View File

@ -56,7 +56,7 @@ class ArchiveManager
* *
* @return void * @return void
*/ */
public function addArchiver(ArchiverInterface $archiver) public function addArchiver(ArchiverInterface $archiver): void
{ {
$this->archivers[] = $archiver; $this->archivers[] = $archiver;
} }

View File

@ -31,7 +31,7 @@ class Comparer
* *
* @return void * @return void
*/ */
public function setSource($source) public function setSource($source): void
{ {
$this->source = $source; $this->source = $source;
} }
@ -41,7 +41,7 @@ class Comparer
* *
* @return void * @return void
*/ */
public function setUpdate($update) public function setUpdate($update): void
{ {
$this->update = $update; $this->update = $update;
} }
@ -82,7 +82,7 @@ class Comparer
/** /**
* @return void * @return void
*/ */
public function doCompare() public function doCompare(): void
{ {
$source = array(); $source = array();
$destination = array(); $destination = array();

View File

@ -45,7 +45,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getScripts(); return $this->aliasOf->getScripts();
} }
public function setScripts(array $scripts) public function setScripts(array $scripts): void
{ {
$this->aliasOf->setScripts($scripts); $this->aliasOf->setScripts($scripts);
} }
@ -55,7 +55,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getRepositories(); return $this->aliasOf->getRepositories();
} }
public function setRepositories(array $repositories) public function setRepositories(array $repositories): void
{ {
$this->aliasOf->setRepositories($repositories); $this->aliasOf->setRepositories($repositories);
} }
@ -65,7 +65,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getLicense(); return $this->aliasOf->getLicense();
} }
public function setLicense(array $license) public function setLicense(array $license): void
{ {
$this->aliasOf->setLicense($license); $this->aliasOf->setLicense($license);
} }
@ -75,7 +75,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getKeywords(); return $this->aliasOf->getKeywords();
} }
public function setKeywords(array $keywords) public function setKeywords(array $keywords): void
{ {
$this->aliasOf->setKeywords($keywords); $this->aliasOf->setKeywords($keywords);
} }
@ -85,7 +85,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getDescription(); return $this->aliasOf->getDescription();
} }
public function setDescription($description) public function setDescription($description): void
{ {
$this->aliasOf->setDescription($description); $this->aliasOf->setDescription($description);
} }
@ -95,7 +95,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getHomepage(); return $this->aliasOf->getHomepage();
} }
public function setHomepage($homepage) public function setHomepage($homepage): void
{ {
$this->aliasOf->setHomepage($homepage); $this->aliasOf->setHomepage($homepage);
} }
@ -105,7 +105,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getAuthors(); return $this->aliasOf->getAuthors();
} }
public function setAuthors(array $authors) public function setAuthors(array $authors): void
{ {
$this->aliasOf->setAuthors($authors); $this->aliasOf->setAuthors($authors);
} }
@ -115,7 +115,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getSupport(); return $this->aliasOf->getSupport();
} }
public function setSupport(array $support) public function setSupport(array $support): void
{ {
$this->aliasOf->setSupport($support); $this->aliasOf->setSupport($support);
} }
@ -125,7 +125,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getFunding(); return $this->aliasOf->getFunding();
} }
public function setFunding(array $funding) public function setFunding(array $funding): void
{ {
$this->aliasOf->setFunding($funding); $this->aliasOf->setFunding($funding);
} }
@ -140,7 +140,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getReplacementPackage(); return $this->aliasOf->getReplacementPackage();
} }
public function setAbandoned($abandoned) public function setAbandoned($abandoned): void
{ {
$this->aliasOf->setAbandoned($abandoned); $this->aliasOf->setAbandoned($abandoned);
} }
@ -150,7 +150,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getArchiveName(); return $this->aliasOf->getArchiveName();
} }
public function setArchiveName($name) public function setArchiveName($name): void
{ {
$this->aliasOf->setArchiveName($name); $this->aliasOf->setArchiveName($name);
} }
@ -160,7 +160,7 @@ class CompleteAliasPackage extends AliasPackage implements CompletePackageInterf
return $this->aliasOf->getArchiveExcludes(); return $this->aliasOf->getArchiveExcludes();
} }
public function setArchiveExcludes(array $excludes) public function setArchiveExcludes(array $excludes): void
{ {
$this->aliasOf->setArchiveExcludes($excludes); $this->aliasOf->setArchiveExcludes($excludes);
} }

View File

@ -91,7 +91,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setRequires(array $require) public function setRequires(array $require): void
{ {
$this->requires = $this->replaceSelfVersionDependencies($require, Link::TYPE_REQUIRE); $this->requires = $this->replaceSelfVersionDependencies($require, Link::TYPE_REQUIRE);
@ -101,7 +101,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setDevRequires(array $devRequire) public function setDevRequires(array $devRequire): void
{ {
$this->devRequires = $this->replaceSelfVersionDependencies($devRequire, Link::TYPE_DEV_REQUIRE); $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, Link::TYPE_DEV_REQUIRE);
@ -111,7 +111,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setConflicts(array $conflicts) public function setConflicts(array $conflicts): void
{ {
$this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT); $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, Link::TYPE_CONFLICT);
$this->aliasOf->setConflicts($conflicts); $this->aliasOf->setConflicts($conflicts);
@ -120,7 +120,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setProvides(array $provides) public function setProvides(array $provides): void
{ {
$this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE); $this->provides = $this->replaceSelfVersionDependencies($provides, Link::TYPE_PROVIDE);
$this->aliasOf->setProvides($provides); $this->aliasOf->setProvides($provides);
@ -129,7 +129,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setReplaces(array $replaces) public function setReplaces(array $replaces): void
{ {
$this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE); $this->replaces = $this->replaceSelfVersionDependencies($replaces, Link::TYPE_REPLACE);
$this->aliasOf->setReplaces($replaces); $this->aliasOf->setReplaces($replaces);
@ -138,7 +138,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setAutoload(array $autoload) public function setAutoload(array $autoload): void
{ {
$this->aliasOf->setAutoload($autoload); $this->aliasOf->setAutoload($autoload);
} }
@ -146,7 +146,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setDevAutoload(array $devAutoload) public function setDevAutoload(array $devAutoload): void
{ {
$this->aliasOf->setDevAutoload($devAutoload); $this->aliasOf->setDevAutoload($devAutoload);
} }
@ -154,7 +154,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setStabilityFlags(array $stabilityFlags) public function setStabilityFlags(array $stabilityFlags): void
{ {
$this->aliasOf->setStabilityFlags($stabilityFlags); $this->aliasOf->setStabilityFlags($stabilityFlags);
} }
@ -162,7 +162,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setMinimumStability($minimumStability) public function setMinimumStability($minimumStability): void
{ {
$this->aliasOf->setMinimumStability($minimumStability); $this->aliasOf->setMinimumStability($minimumStability);
} }
@ -170,7 +170,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setPreferStable($preferStable) public function setPreferStable($preferStable): void
{ {
$this->aliasOf->setPreferStable($preferStable); $this->aliasOf->setPreferStable($preferStable);
} }
@ -178,7 +178,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setConfig(array $config) public function setConfig(array $config): void
{ {
$this->aliasOf->setConfig($config); $this->aliasOf->setConfig($config);
} }
@ -186,7 +186,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setReferences(array $references) public function setReferences(array $references): void
{ {
$this->aliasOf->setReferences($references); $this->aliasOf->setReferences($references);
} }
@ -194,7 +194,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setAliases(array $aliases) public function setAliases(array $aliases): void
{ {
$this->aliasOf->setAliases($aliases); $this->aliasOf->setAliases($aliases);
} }
@ -202,7 +202,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setSuggests(array $suggests) public function setSuggests(array $suggests): void
{ {
$this->aliasOf->setSuggests($suggests); $this->aliasOf->setSuggests($suggests);
} }
@ -210,7 +210,7 @@ class RootAliasPackage extends CompleteAliasPackage implements RootPackageInterf
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setExtra(array $extra) public function setExtra(array $extra): void
{ {
$this->aliasOf->setExtra($extra); $this->aliasOf->setExtra($extra);
} }

View File

@ -37,7 +37,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* {@inerhitDoc} * {@inerhitDoc}
*/ */
public function setMinimumStability($minimumStability) public function setMinimumStability($minimumStability): void
{ {
$this->minimumStability = $minimumStability; $this->minimumStability = $minimumStability;
} }
@ -53,7 +53,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function setStabilityFlags(array $stabilityFlags) public function setStabilityFlags(array $stabilityFlags): void
{ {
$this->stabilityFlags = $stabilityFlags; $this->stabilityFlags = $stabilityFlags;
} }
@ -69,7 +69,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* {@inerhitDoc} * {@inerhitDoc}
*/ */
public function setPreferStable($preferStable) public function setPreferStable($preferStable): void
{ {
$this->preferStable = $preferStable; $this->preferStable = $preferStable;
} }
@ -85,7 +85,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* {@inerhitDoc} * {@inerhitDoc}
*/ */
public function setConfig(array $config) public function setConfig(array $config): void
{ {
$this->config = $config; $this->config = $config;
} }
@ -101,7 +101,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* {@inerhitDoc} * {@inerhitDoc}
*/ */
public function setReferences(array $references) public function setReferences(array $references): void
{ {
$this->references = $references; $this->references = $references;
} }
@ -117,7 +117,7 @@ class RootPackage extends CompletePackage implements RootPackageInterface
/** /**
* {@inerhitDoc} * {@inerhitDoc}
*/ */
public function setAliases(array $aliases) public function setAliases(array $aliases): void
{ {
$this->aliases = $aliases; $this->aliases = $aliases;
} }

View File

@ -34,7 +34,7 @@ class HhvmDetector
/** /**
* @return void * @return void
*/ */
public function reset() public function reset(): void
{ {
self::$hhvmVersion = null; self::$hhvmVersion = null;
} }

View File

@ -92,7 +92,7 @@ class PluginManager
* *
* @return void * @return void
*/ */
public function loadInstalledPlugins() public function loadInstalledPlugins(): void
{ {
if ($this->disablePlugins) { if ($this->disablePlugins) {
return; return;
@ -111,7 +111,7 @@ class PluginManager
* *
* @return void * @return void
*/ */
public function deactivateInstalledPlugins() public function deactivateInstalledPlugins(): void
{ {
if ($this->disablePlugins) { if ($this->disablePlugins) {
return; return;
@ -159,7 +159,7 @@ class PluginManager
* *
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
public function registerPackage(PackageInterface $package, $failOnMissingClasses = false, $isGlobalPlugin = false) public function registerPackage(PackageInterface $package, $failOnMissingClasses = false, $isGlobalPlugin = false): void
{ {
if ($this->disablePlugins) { if ($this->disablePlugins) {
return; return;
@ -318,7 +318,7 @@ class PluginManager
* *
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
public function deactivatePackage(PackageInterface $package) public function deactivatePackage(PackageInterface $package): void
{ {
if ($this->disablePlugins) { if ($this->disablePlugins) {
return; return;
@ -349,7 +349,7 @@ class PluginManager
* *
* @throws \UnexpectedValueException * @throws \UnexpectedValueException
*/ */
public function uninstallPackage(PackageInterface $package) public function uninstallPackage(PackageInterface $package): void
{ {
if ($this->disablePlugins) { if ($this->disablePlugins) {
return; return;
@ -392,7 +392,7 @@ class PluginManager
* *
* @return void * @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) { 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); 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 * @return void
*/ */
public function removePlugin(PluginInterface $plugin) public function removePlugin(PluginInterface $plugin): void
{ {
$index = array_search($plugin, $this->plugins, true); $index = array_search($plugin, $this->plugins, true);
if ($index === false) { if ($index === false) {
@ -454,7 +454,7 @@ class PluginManager
* *
* @return void * @return void
*/ */
public function uninstallPlugin(PluginInterface $plugin) public function uninstallPlugin(PluginInterface $plugin): void
{ {
$this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG); $this->io->writeError('Uninstalling plugin '.get_class($plugin), true, IOInterface::DEBUG);
$plugin->uninstall($this->composer, $this->io); $plugin->uninstall($this->composer, $this->io);
@ -476,7 +476,7 @@ class PluginManager
* *
* @throws \RuntimeException * @throws \RuntimeException
*/ */
private function loadRepository(RepositoryInterface $repo, $isGlobalRepo) private function loadRepository(RepositoryInterface $repo, $isGlobalRepo): void
{ {
$packages = $repo->getPackages(); $packages = $repo->getPackages();
$sortedPackages = PackageSorter::sortPackages($packages); $sortedPackages = PackageSorter::sortPackages($packages);
@ -503,7 +503,7 @@ class PluginManager
* *
* @return void * @return void
*/ */
private function deactivateRepository(RepositoryInterface $repo, $isGlobalRepo) private function deactivateRepository(RepositoryInterface $repo, $isGlobalRepo): void
{ {
$packages = $repo->getPackages(); $packages = $repo->getPackages();
$sortedPackages = array_reverse(PackageSorter::sortPackages($packages)); $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));

View File

@ -95,7 +95,7 @@ class PreFileDownloadEvent extends Event
* *
* @return void * @return void
*/ */
public function setProcessedUrl($processedUrl) public function setProcessedUrl($processedUrl): void
{ {
$this->processedUrl = $processedUrl; $this->processedUrl = $processedUrl;
} }
@ -117,7 +117,7 @@ class PreFileDownloadEvent extends Event
* *
* @return void * @return void
*/ */
public function setCustomCacheKey($customCacheKey) public function setCustomCacheKey($customCacheKey): void
{ {
$this->customCacheKey = $customCacheKey; $this->customCacheKey = $customCacheKey;
} }
@ -166,7 +166,7 @@ class PreFileDownloadEvent extends Event
* *
* @return void * @return void
*/ */
public function setTransportOptions(array $options) public function setTransportOptions(array $options): void
{ {
$this->transportOptions = $options; $this->transportOptions = $options;
} }

View File

@ -163,7 +163,7 @@ class PrePoolCreateEvent extends Event
* *
* @return void * @return void
*/ */
public function setPackages(array $packages) public function setPackages(array $packages): void
{ {
$this->packages = $packages; $this->packages = $packages;
} }
@ -173,7 +173,7 @@ class PrePoolCreateEvent extends Event
* *
* @return void * @return void
*/ */
public function setUnacceptableFixedPackages(array $packages) public function setUnacceptableFixedPackages(array $packages): void
{ {
$this->unacceptableFixedPackages = $packages; $this->unacceptableFixedPackages = $packages;
} }

View File

@ -166,7 +166,7 @@ class CompositeRepository implements RepositoryInterface
/** /**
* @return void * @return void
*/ */
public function removePackage(PackageInterface $package) public function removePackage(PackageInterface $package): void
{ {
foreach ($this->repositories as $repository) { foreach ($this->repositories as $repository) {
if ($repository instanceof WritableRepositoryInterface) { if ($repository instanceof WritableRepositoryInterface) {
@ -195,7 +195,7 @@ class CompositeRepository implements RepositoryInterface
* *
* @return void * @return void
*/ */
public function addRepository(RepositoryInterface $repository) public function addRepository(RepositoryInterface $repository): void
{ {
if ($repository instanceof self) { if ($repository instanceof self) {
foreach ($repository->getRepositories() as $repo) { foreach ($repository->getRepositories() as $repo) {

View File

@ -259,7 +259,7 @@ class InstalledRepository extends CompositeRepository
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function addRepository(RepositoryInterface $repository) public function addRepository(RepositoryInterface $repository): void
{ {
if ( if (
$repository instanceof LockArrayRepository $repository instanceof LockArrayRepository

View File

@ -45,7 +45,7 @@ class PackageRepository extends ArrayRepository
/** /**
* Initializes repository (reads file, or remote address). * Initializes repository (reads file, or remote address).
*/ */
protected function initialize() protected function initialize(): void
{ {
parent::initialize(); parent::initialize();

View File

@ -144,7 +144,7 @@ class PathRepository extends ArrayRepository implements ConfigurableRepositoryIn
* *
* This method will basically read the folder and add the found package. * This method will basically read the folder and add the found package.
*/ */
protected function initialize() protected function initialize(): void
{ {
parent::initialize(); parent::initialize();

View File

@ -106,7 +106,7 @@ class PlatformRepository extends ArrayRepository
return $this->disabledPackages; return $this->disabledPackages;
} }
protected function initialize() protected function initialize(): void
{ {
parent::initialize(); parent::initialize();
@ -531,7 +531,7 @@ class PlatformRepository extends ArrayRepository
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function addPackage(PackageInterface $package) public function addPackage(PackageInterface $package): void
{ {
if (!$package instanceof CompletePackage) { if (!$package instanceof CompletePackage) {
throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package)); throw new \UnexpectedValueException('Expected CompletePackage but got '.get_class($package));
@ -604,7 +604,7 @@ class PlatformRepository extends ArrayRepository
/** /**
* @return void * @return void
*/ */
private function addDisabledPackage(CompletePackage $package) private function addDisabledPackage(CompletePackage $package): void
{ {
$package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>'); $package->setDescription($package->getDescription().'. <warning>Package disabled via config.platform</warning>');
$package->setExtra(array('config.platform' => true)); $package->setExtra(array('config.platform' => true));
@ -620,7 +620,7 @@ class PlatformRepository extends ArrayRepository
* *
* @return void * @return void
*/ */
private function addExtension($name, $prettyVersion) private function addExtension($name, $prettyVersion): void
{ {
$extraDescription = null; $extraDescription = null;
@ -667,7 +667,7 @@ class PlatformRepository extends ArrayRepository
* *
* @return void * @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 { try {
$version = $this->versionParser->normalize($prettyVersion); $version = $this->versionParser->normalize($prettyVersion);

View File

@ -118,7 +118,7 @@ class RepositorySet
* *
* @return void * @return void
*/ */
public function allowInstalledRepositories($allow = true) public function allowInstalledRepositories($allow = true): void
{ {
$this->allowInstalledRepositories = $allow; $this->allowInstalledRepositories = $allow;
} }
@ -142,7 +142,7 @@ class RepositorySet
* *
* @return void * @return void
*/ */
public function addRepository(RepositoryInterface $repo) public function addRepository(RepositoryInterface $repo): void
{ {
if ($this->locked) { if ($this->locked) {
throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore."); throw new \RuntimeException("Pool has already been created from this repository set, it cannot be modified anymore.");

View File

@ -38,7 +38,7 @@ class FossilDriver extends VcsDriver
/** /**
* @inheritDoc * @inheritDoc
*/ */
public function initialize() public function initialize(): void
{ {
// Make sure fossil is installed and reachable. // Make sure fossil is installed and reachable.
$this->checkFossil(); $this->checkFossil();
@ -71,7 +71,7 @@ class FossilDriver extends VcsDriver
* *
* @return void * @return void
*/ */
protected function checkFossil() protected function checkFossil(): void
{ {
if (0 !== $this->process->execute('fossil version', $ignoredOutput)) { 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()); 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 * @return void
*/ */
protected function updateLocalRepo() protected function updateLocalRepo(): void
{ {
$fs = new Filesystem(); $fs = new Filesystem();
$fs->ensureDirectoryExists($this->checkoutDir); $fs->ensureDirectoryExists($this->checkoutDir);

View File

@ -91,7 +91,7 @@ class GitLabDriver extends VcsDriver
* *
* @inheritDoc * @inheritDoc
*/ */
public function initialize() public function initialize(): void
{ {
if (!Preg::isMatch(self::URL_REGEX, $this->url, $match)) { 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)); 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 * @return void
*/ */
public function setHttpDownloader(HttpDownloader $httpDownloader) public function setHttpDownloader(HttpDownloader $httpDownloader): void
{ {
$this->httpDownloader = $httpDownloader; $this->httpDownloader = $httpDownloader;
} }
@ -383,7 +383,7 @@ class GitLabDriver extends VcsDriver
/** /**
* @return void * @return void
*/ */
protected function fetchProject() protected function fetchProject(): void
{ {
// we need to fetch the default branch from the api // we need to fetch the default branch from the api
$resource = $this->getApiUrl(); $resource = $this->getApiUrl();
@ -452,7 +452,7 @@ class GitLabDriver extends VcsDriver
* *
* @return void * @return void
*/ */
protected function setupGitDriver($url) protected function setupGitDriver($url): void
{ {
$this->gitDriver = new GitDriver( $this->gitDriver = new GitDriver(
array('url' => $url), array('url' => $url),

View File

@ -63,7 +63,7 @@ class Versions
* *
* @return void * @return void
*/ */
public function setChannel($channel) public function setChannel($channel): void
{ {
if (!in_array($channel, self::$channels, true)) { if (!in_array($channel, self::$channels, true)) {
throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels)); throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));

View File

@ -41,7 +41,7 @@ class AuthHelper
* *
* @return void * @return void
*/ */
public function storeAuth($origin, $storeAuth) public function storeAuth($origin, $storeAuth): void
{ {
$store = false; $store = false;
$configSource = $this->config->getAuthConfigSource(); $configSource = $this->config->getAuthConfigSource();

View File

@ -223,7 +223,7 @@ class Bitbucket
* *
* @return void * @return void
*/ */
private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret) private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret): void
{ {
$this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl); $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);

View File

@ -76,7 +76,7 @@ class ErrorHandler
* *
* @return void * @return void
*/ */
public static function register(IOInterface $io = null) public static function register(IOInterface $io = null): void
{ {
set_error_handler(array(__CLASS__, 'handle')); set_error_handler(array(__CLASS__, 'handle'));
error_reporting(E_ALL | E_STRICT); error_reporting(E_ALL | E_STRICT);

View File

@ -53,7 +53,7 @@ class Hg
* *
* @return void * @return void
*/ */
public function runCommand($commandCallable, $url, $cwd) public function runCommand($commandCallable, $url, $cwd): void
{ {
$this->config->prohibitUrlByConfig($url, $this->io); $this->config->prohibitUrlByConfig($url, $this->io);

View File

@ -180,7 +180,7 @@ class CurlDownloader
if ($copyTo) { if ($copyTo) {
$errorMessage = ''; $errorMessage = '';
// @phpstan-ignore-next-line // @phpstan-ignore-next-line
set_error_handler(function ($code, $msg) use (&$errorMessage) { set_error_handler(function ($code, $msg) use (&$errorMessage): void {
if ($errorMessage) { if ($errorMessage) {
$errorMessage .= "\n"; $errorMessage .= "\n";
} }
@ -287,7 +287,7 @@ class CurlDownloader
* @param int $id * @param int $id
* @return void * @return void
*/ */
public function abortRequest($id) public function abortRequest($id): void
{ {
if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) { if (isset($this->jobs[$id], $this->jobs[$id]['curlHandle'])) {
$job = $this->jobs[$id]; $job = $this->jobs[$id];
@ -309,7 +309,7 @@ class CurlDownloader
/** /**
* @return void * @return void
*/ */
public function tick() public function tick(): void
{ {
static $timeoutWarning = false; static $timeoutWarning = false;
@ -579,7 +579,7 @@ class CurlDownloader
* *
* @return void * @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']) { if (null !== $job['filename']) {
@unlink($job['filename'].'~'); @unlink($job['filename'].'~');
@ -614,7 +614,7 @@ class CurlDownloader
* @param Job $job * @param Job $job
* @return void * @return void
*/ */
private function rejectJob(array $job, \Exception $e) private function rejectJob(array $job, \Exception $e): void
{ {
if (is_resource($job['headerHandle'])) { if (is_resource($job['headerHandle'])) {
fclose($job['headerHandle']); fclose($job['headerHandle']);
@ -632,7 +632,7 @@ class CurlDownloader
* @param int $code * @param int $code
* @return void * @return void
*/ */
private function checkCurlResult($code) private function checkCurlResult($code): void
{ {
if ($code != CURLM_OK && $code != CURLM_CALL_MULTI_PERFORM) { if ($code != CURLM_OK && $code != CURLM_CALL_MULTI_PERFORM) {
throw new \RuntimeException( throw new \RuntimeException(

View File

@ -97,7 +97,7 @@ class ProxyHelper
* *
* @return void * @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)) { if ('http' === parse_url($requestUrl, PHP_URL_SCHEME)) {
$options['http']['request_fulluri'] = true; $options['http']['request_fulluri'] = true;

View File

@ -72,7 +72,7 @@ class ProxyManager
* *
* @return void * @return void
*/ */
public static function reset() public static function reset(): void
{ {
self::$instance = null; self::$instance = null;
} }
@ -133,7 +133,7 @@ class ProxyManager
* *
* @return void * @return void
*/ */
private function initProxyData() private function initProxyData(): void
{ {
try { try {
list($httpProxy, $httpsProxy, $noProxy) = ProxyHelper::getProxyData(); list($httpProxy, $httpsProxy, $noProxy) = ProxyHelper::getProxyData();

View File

@ -109,7 +109,7 @@ class Response
* @return void * @return void
* @phpstan-impure * @phpstan-impure
*/ */
public function collect() public function collect(): void
{ {
/** @phpstan-ignore-next-line */ /** @phpstan-ignore-next-line */
$this->request = $this->code = $this->headers = $this->body = null; $this->request = $this->code = $this->headers = $this->body = null;

View File

@ -62,15 +62,15 @@ class Loop
* @param ?ProgressBar $progress * @param ?ProgressBar $progress
* @return void * @return void
*/ */
public function wait(array $promises, ProgressBar $progress = null) public function wait(array $promises, ProgressBar $progress = null): void
{ {
/** @var \Exception|null */ /** @var \Exception|null */
$uncaught = null; $uncaught = null;
\React\Promise\all($promises)->then( \React\Promise\all($promises)->then(
function () { function (): void {
}, },
function ($e) use (&$uncaught) { function ($e) use (&$uncaught): void {
$uncaught = $e; $uncaught = $e;
} }
); );
@ -122,7 +122,7 @@ class Loop
/** /**
* @return void * @return void
*/ */
public function abortJobs() public function abortJobs(): void
{ {
foreach ($this->currentPromises as $promiseGroup) { foreach ($this->currentPromises as $promiseGroup) {
foreach ($promiseGroup as $promise) { foreach ($promiseGroup as $promise) {

View File

@ -69,17 +69,17 @@ class PackageSorter
$weightList[$index] = $weight; $weightList[$index] = $weight;
} }
$stable_sort = function (&$array) { $stable_sort = function (&$array): void {
static $transform, $restore; static $transform, $restore;
$i = 0; $i = 0;
if (!$transform) { if (!$transform) {
$transform = function (&$v, $k) use (&$i) { $transform = function (&$v, $k) use (&$i): void {
$v = array($v, ++$i, $k, $v); $v = array($v, ++$i, $k, $v);
}; };
$restore = function (&$v) { $restore = function (&$v): void {
$v = $v[3]; $v = $v[3];
}; };
} }

View File

@ -51,7 +51,7 @@ class Platform
* @param string $value * @param string $value
* @return void * @return void
*/ */
public static function putEnv($name, $value) public static function putEnv($name, $value): void
{ {
$value = (string) $value; $value = (string) $value;
putenv($name . '=' . $value); putenv($name . '=' . $value);
@ -64,7 +64,7 @@ class Platform
* @param string $name * @param string $name
* @return void * @return void
*/ */
public static function clearEnv($name) public static function clearEnv($name): void
{ {
putenv($name); putenv($name);
unset($_SERVER[$name], $_ENV[$name]); unset($_SERVER[$name], $_ENV[$name]);
@ -202,7 +202,7 @@ class Platform
/** /**
* @return void * @return void
*/ */
public static function workaroundFilesystemIssues() public static function workaroundFilesystemIssues(): void
{ {
if (self::isVirtualBoxGuest()) { if (self::isVirtualBoxGuest()) {
usleep(200000); usleep(200000);

View File

@ -47,7 +47,7 @@ class Silencer
* *
* @return void * @return void
*/ */
public static function restore() public static function restore(): void
{ {
if (!empty(self::$stack)) { if (!empty(self::$stack)) {
error_reporting(array_pop(self::$stack)); error_reporting(array_pop(self::$stack));

View File

@ -86,7 +86,7 @@ class Svn
/** /**
* @return void * @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 // clean up env for OSX, see https://github.com/composer/composer/issues/2146#issuecomment-35478940
Platform::clearEnv('DYLD_LIBRARY_PATH'); Platform::clearEnv('DYLD_LIBRARY_PATH');
@ -194,7 +194,7 @@ class Svn
* @param bool $cacheCredentials * @param bool $cacheCredentials
* @return void * @return void
*/ */
public function setCacheCredentials($cacheCredentials) public function setCacheCredentials($cacheCredentials): void
{ {
$this->cacheCredentials = $cacheCredentials; $this->cacheCredentials = $cacheCredentials;
} }

View File

@ -31,7 +31,7 @@ class SyncHelper
* *
* @return void * @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'; $type = $prevPackage ? 'update' : 'install';
@ -61,7 +61,7 @@ class SyncHelper
* *
* @return void * @return void
*/ */
public static function await(Loop $loop, PromiseInterface $promise = null) public static function await(Loop $loop, PromiseInterface $promise = null): void
{ {
if ($promise) { if ($promise) {
$loop->wait(array($promise)); $loop->wait(array($promise));

View File

@ -63,7 +63,7 @@ class AllFunctionalTest extends TestCase
$fs->removeDirectory(dirname(self::$pharPath)); $fs->removeDirectory(dirname(self::$pharPath));
} }
public function testBuildPhar() public function testBuildPhar(): void
{ {
if (defined('HHVM_VERSION')) { if (defined('HHVM_VERSION')) {
$this->markTestSkipped('Building the phar does not work on HHVM.'); $this->markTestSkipped('Building the phar does not work on HHVM.');
@ -100,7 +100,7 @@ class AllFunctionalTest extends TestCase
* @depends testBuildPhar * @depends testBuildPhar
* @param string $testFile * @param string $testFile
*/ */
public function testIntegration($testFile) public function testIntegration($testFile): void
{ {
$testData = $this->parseTestFile($testFile); $testData = $this->parseTestFile($testFile);
$this->testDir = self::getUniqueTmpDirectory(); $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); $proc = Process::fromShellCommandline(escapeshellcmd(PHP_BINARY).' '.escapeshellarg(self::$pharPath).' --no-ansi '.$testData['RUN'], $this->testDir, $env, null, 300);
$output = ''; $output = '';
$exitCode = $proc->run(function ($type, $buffer) use (&$output) { $exitCode = $proc->run(function ($type, $buffer) use (&$output): void {
$output .= $buffer; $output .= $buffer;
}); });

View File

@ -25,7 +25,7 @@ class ApplicationTest extends TestCase
putenv('COMPOSER_NO_INTERACTION'); putenv('COMPOSER_NO_INTERACTION');
} }
public function testDevWarning() public function testDevWarning(): void
{ {
$application = new Application; $application = new Application;
@ -84,7 +84,7 @@ class ApplicationTest extends TestCase
* @param string $command * @param string $command
* @return void * @return void
*/ */
public function ensureNoDevWarning($command) public function ensureNoDevWarning($command): void
{ {
$application = new Application; $application = new Application;
@ -133,12 +133,12 @@ class ApplicationTest extends TestCase
$application->doRun($inputMock, $outputMock); $application->doRun($inputMock, $outputMock);
} }
public function testDevWarningPrevented() public function testDevWarningPrevented(): void
{ {
$this->ensureNoDevWarning('self-update'); $this->ensureNoDevWarning('self-update');
} }
public function testDevWarningPreventedAlias() public function testDevWarningPreventedAlias(): void
{ {
$this->ensureNoDevWarning('self-up'); $this->ensureNoDevWarning('self-up');
} }

View File

@ -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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -206,7 +206,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap', $this->vendorDir.'/composer', 'classmap');
} }
public function testRootPackageDevAutoloading() public function testRootPackageDevAutoloading(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -244,7 +244,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files'); $this->assertAutoloadFiles('files2', $this->vendorDir.'/composer', 'files');
} }
public function testRootPackageDevAutoloadingDisabledByDefault() public function testRootPackageDevAutoloadingDisabledByDefault(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -277,7 +277,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php')); $this->assertFalse(is_file($this->vendorDir.'/composer/autoload_files.php'));
} }
public function testVendorDirSameAsWorkingDir() public function testVendorDirSameAsWorkingDir(): void
{ {
$this->vendorDir = $this->workingDir; $this->vendorDir = $this->workingDir;
@ -308,7 +308,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap3', $this->vendorDir.'/composer', 'classmap');
} }
public function testRootPackageAutoloadingAlternativeVendorDir() public function testRootPackageAutoloadingAlternativeVendorDir(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -337,7 +337,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap2', $this->vendorDir.'/composer', 'classmap');
} }
public function testRootPackageAutoloadingWithTargetDir() public function testRootPackageAutoloadingWithTargetDir(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -368,7 +368,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap6', $this->vendorDir.'/composer', 'classmap');
} }
public function testVendorsAutoloading() public function testVendorsAutoloading(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $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."); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $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."); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array('a/a' => new Link('a', 'a/a', new MatchAllConstraint()))); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $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."); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -549,7 +549,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap9', $this->vendorDir.'/composer', 'classmap');
} }
public function testPharAutoload() public function testPharAutoload(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -590,7 +590,7 @@ class AutoloadGeneratorTest extends TestCase
$this->assertAutoloadFiles('phar_static', $this->vendorDir . '/composer', 'static'); $this->assertAutoloadFiles('phar_static', $this->vendorDir . '/composer', 'static');
} }
public function testPSRToClassMapIgnoresNonExistingDir() public function testPSRToClassMapIgnoresNonExistingDir(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $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'); $package = new RootPackage('root/a', '1.0', '1.0');
@ -654,7 +654,7 @@ EOF;
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -694,7 +694,7 @@ EOF;
$this->assertAutoloadFiles('classmap4', $this->vendorDir.'/composer', 'classmap'); $this->assertAutoloadFiles('classmap4', $this->vendorDir.'/composer', 'classmap');
} }
public function testVendorsClassMapAutoloadingWithTargetDir() public function testVendorsClassMapAutoloadingWithTargetDir(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -779,7 +779,7 @@ EOF;
$this->assertStringNotContainsString('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -828,7 +828,7 @@ EOF;
$this->assertStringContainsString('$loader->setApcuPrefix(', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires(array( $package->setRequires(array(
@ -877,7 +877,7 @@ EOF;
$this->assertStringContainsString('$loader->setApcuPrefix(\'custom\\\'Prefix\');', file_get_contents($this->vendorDir.'/composer/autoload_real.php')); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array('files' => array('root.php'))); $package->setAutoload(array('files' => array('root.php')));
@ -924,7 +924,7 @@ EOF;
$this->assertTrue(function_exists('testFilesAutoloadGenerationRoot')); $this->assertTrue(function_exists('testFilesAutoloadGenerationRoot'));
} }
public function testFilesAutoloadGenerationRemoveExtraEntitiesFromAutoloadFiles() public function testFilesAutoloadGenerationRemoveExtraEntitiesFromAutoloadFiles(): void
{ {
$autoloadPackage = new RootPackage('root/a', '1.0', '1.0'); $autoloadPackage = new RootPackage('root/a', '1.0', '1.0');
$autoloadPackage->setAutoload(array('files' => array('root.php'))); $autoloadPackage->setAutoload(array('files' => array('root.php')));
@ -995,7 +995,7 @@ EOF;
$this->assertFileDoesNotExist($this->vendorDir.'/composer/include_paths.php'); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array('files' => array('root2.php'))); $package->setAutoload(array('files' => array('root2.php')));
@ -1065,7 +1065,7 @@ EOF;
* - The main package has priority over other packages. * - The main package has priority over other packages.
* - Longer namespaces have priority over shorter namespaces. * - Longer namespaces have priority over shorter namespaces.
*/ */
public function testOverrideVendorsAutoloading() public function testOverrideVendorsAutoloading(): void
{ {
$rootPackage = new RootPackage('root/z', '1.0', '1.0'); $rootPackage = new RootPackage('root/z', '1.0', '1.0');
$rootPackage->setAutoload(array( $rootPackage->setAutoload(array(
@ -1160,7 +1160,7 @@ EOF;
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); $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'); $package = new RootPackage('root/a', '1.0', '1.0');
$packages = array(); $packages = array();
@ -1197,7 +1197,7 @@ EOF;
); );
} }
public function testIncludePathsArePrependedInAutoloadFile() public function testIncludePathsArePrependedInAutoloadFile(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$packages = array(); $packages = array();
@ -1228,7 +1228,7 @@ EOF;
set_include_path($oldIncludePath); set_include_path($oldIncludePath);
} }
public function testIncludePathsInRootPackage() public function testIncludePathsInRootPackage(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$package->setIncludePaths(array('/lib', '/src')); $package->setIncludePaths(array('/lib', '/src'));
@ -1257,7 +1257,7 @@ EOF;
set_include_path($oldIncludePath); set_include_path($oldIncludePath);
} }
public function testIncludePathFileWithoutPathsIsSkipped() public function testIncludePathFileWithoutPathsIsSkipped(): void
{ {
$package = new RootPackage('root/a', '1.0', '1.0'); $package = new RootPackage('root/a', '1.0', '1.0');
$packages = array(); $packages = array();
@ -1276,7 +1276,7 @@ EOF;
$this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php"); $this->assertFileDoesNotExist($this->vendorDir."/composer/include_paths.php");
} }
public function testPreAndPostEventsAreDispatchedDuringAutoloadDump() public function testPreAndPostEventsAreDispatchedDuringAutoloadDump(): void
{ {
$this->eventDispatcher $this->eventDispatcher
->expects($this->exactly(2)) ->expects($this->exactly(2))
@ -1297,7 +1297,7 @@ EOF;
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_8'); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -1318,7 +1318,7 @@ EOF;
$this->assertFileContentEquals(__DIR__.'/Fixtures/autoload_static_include_path.php', $this->vendorDir.'/composer/autoload_static.php'); $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'; $workingDir = $this->vendorDir.'/working-dir';
$vendorDir = $workingDir.'/../vendor'; $vendorDir = $workingDir.'/../vendor';
@ -1432,7 +1432,7 @@ EOF;
$this->assertStringContainsString("\$baseDir . '/test.php',\n", file_get_contents($vendorDir.'/composer/autoload_files.php')); $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'; $workingDir = $this->workingDir.'/working-dir';
mkdir($workingDir, 0777, true); mkdir($workingDir, 0777, true);
@ -1516,7 +1516,7 @@ EOF;
$this->assertStringContainsString("\$baseDir . '/../test.php',\n", file_get_contents($this->vendorDir.'/composer/autoload_files.php')); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -1584,7 +1584,7 @@ EOF;
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_classmap.php', $expectedClassmap); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -1631,7 +1631,7 @@ EOF;
$this->assertStringEqualsFile($this->vendorDir.'/composer/autoload_psr4.php', $expectedPsr4); $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 = new RootPackage('root/a', '1.0', '1.0');
$package->setAutoload(array( $package->setAutoload(array(
@ -1709,7 +1709,7 @@ EOF;
* *
* @dataProvider platformCheckProvider * @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 = new RootPackage('root/a', '1.0', '1.0');
$package->setRequires($requires); $package->setRequires($requires);
@ -1850,7 +1850,7 @@ EOF;
* *
* @return void * @return void
*/ */
private function assertAutoloadFiles($name, $dir, $type = 'namespaces') private function assertAutoloadFiles($name, $dir, $type = 'namespaces'): void
{ {
$a = __DIR__.'/Fixtures/autoload_'.$name.'.php'; $a = __DIR__.'/Fixtures/autoload_'.$name.'.php';
$b = $dir.'/autoload_'.$type.'.php'; $b = $dir.'/autoload_'.$type.'.php';
@ -1864,7 +1864,7 @@ EOF;
* *
* @return void * @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( self::assertSame(
str_replace("\r", '', (string) file_get_contents($expected)), str_replace("\r", '', (string) file_get_contents($expected)),

View File

@ -27,7 +27,7 @@ class ClassLoaderTest extends TestCase
* *
* @param string $class The fully-qualified class name to test, without preceding namespace separator. * @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 = new ClassLoader();
$loader->add('Namespaced\\', __DIR__ . '/Fixtures'); $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 * 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(); $loader = new ClassLoader();
$this->assertEmpty($loader->getPrefixes()); $this->assertEmpty($loader->getPrefixes());

View File

@ -30,7 +30,7 @@ class ClassMapGeneratorTest extends TestCase
* @param string $directory * @param string $directory
* @param array<string, string> $expected * @param array<string, string> $expected
*/ */
public function testCreateMap($directory, $expected) public function testCreateMap($directory, $expected): void
{ {
$this->assertEqualsNormalized($expected, ClassMapGenerator::createMap($directory)); $this->assertEqualsNormalized($expected, ClassMapGenerator::createMap($directory));
} }
@ -120,7 +120,7 @@ class ClassMapGeneratorTest extends TestCase
return $data; return $data;
} }
public function testCreateMapFinderSupport() public function testCreateMapFinderSupport(): void
{ {
$this->checkIfFinderIsAvailable(); $this->checkIfFinderIsAvailable();
@ -133,7 +133,7 @@ class ClassMapGeneratorTest extends TestCase
), ClassMapGenerator::createMap($finder)); ), ClassMapGenerator::createMap($finder));
} }
public function testFindClassesThrowsWhenFileDoesNotExist() public function testFindClassesThrowsWhenFileDoesNotExist(): void
{ {
$r = new \ReflectionClass('Composer\\Autoload\\ClassMapGenerator'); $r = new \ReflectionClass('Composer\\Autoload\\ClassMapGenerator');
$find = $r->getMethod('findClasses'); $find = $r->getMethod('findClasses');
@ -144,7 +144,7 @@ class ClassMapGeneratorTest extends TestCase
$find->invoke(null, __DIR__ . '/no-file'); $find->invoke(null, __DIR__ . '/no-file');
} }
public function testAmbiguousReference() public function testAmbiguousReference(): void
{ {
$this->checkIfFinderIsAvailable(); $this->checkIfFinderIsAvailable();
@ -167,7 +167,7 @@ class ClassMapGeneratorTest extends TestCase
$io->expects($this->once()) $io->expects($this->once())
->method('writeError') ->method('writeError')
->will($this->returnCallback(function ($text) use (&$msg) { ->will($this->returnCallback(function ($text) use (&$msg): void {
$msg = $text; $msg = $text;
})); }));
@ -188,7 +188,7 @@ class ClassMapGeneratorTest extends TestCase
* If one file has a class or interface defined more than once, * If one file has a class or interface defined more than once,
* an ambiguous reference warning should not be produced * an ambiguous reference warning should not be produced
*/ */
public function testUnambiguousReference() public function testUnambiguousReference(): void
{ {
$tempDir = $this->getUniqueTmpDirectory(); $tempDir = $this->getUniqueTmpDirectory();
@ -224,14 +224,14 @@ class ClassMapGeneratorTest extends TestCase
$fs->removeDirectory($tempDir); $fs->removeDirectory($tempDir);
} }
public function testCreateMapThrowsWhenDirectoryDoesNotExist() public function testCreateMapThrowsWhenDirectoryDoesNotExist(): void
{ {
self::expectException('RuntimeException'); self::expectException('RuntimeException');
self::expectExceptionMessage('Could not scan for classes inside'); self::expectExceptionMessage('Could not scan for classes inside');
ClassMapGenerator::createMap(__DIR__ . '/no-file.no-foler'); ClassMapGenerator::createMap(__DIR__ . '/no-file.no-foler');
} }
public function testDump() public function testDump(): void
{ {
$tempDir = self::getUniqueTmpDirectory(); $tempDir = self::getUniqueTmpDirectory();
@ -249,7 +249,7 @@ class ClassMapGeneratorTest extends TestCase
$fs->removeDirectory($tempDir); $fs->removeDirectory($tempDir);
} }
public function testCreateMapDoesNotHitRegexBacktraceLimit() public function testCreateMapDoesNotHitRegexBacktraceLimit(): void
{ {
$expected = array( $expected = array(
'Foo\\StripNoise' => realpath(__DIR__) . '/Fixtures/pcrebacktracelimit/StripNoise.php', 'Foo\\StripNoise' => realpath(__DIR__) . '/Fixtures/pcrebacktracelimit/StripNoise.php',
@ -274,7 +274,7 @@ class ClassMapGeneratorTest extends TestCase
* @param string $message * @param string $message
* @return void * @return void
*/ */
protected function assertEqualsNormalized($expected, $actual, $message = '') protected function assertEqualsNormalized($expected, $actual, $message = ''): void
{ {
foreach ($expected as $ns => $path) { foreach ($expected as $ns => $path) {
$expected[$ns] = strtr($path, '\\', '/'); $expected[$ns] = strtr($path, '\\', '/');
@ -286,7 +286,7 @@ class ClassMapGeneratorTest extends TestCase
} }
/** @return void */ /** @return void */
private function checkIfFinderIsAvailable() private function checkIfFinderIsAvailable(): void
{ {
if (!class_exists('Symfony\\Component\\Finder\\Finder')) { if (!class_exists('Symfony\\Component\\Finder\\Finder')) {
$this->markTestSkipped('Finder component is not available'); $this->markTestSkipped('Finder component is not available');

View File

@ -62,7 +62,7 @@ class CacheTest extends TestCase
} }
} }
public function testRemoveOutdatedFiles() public function testRemoveOutdatedFiles(): void
{ {
$outdated = array_slice($this->files, 1); $outdated = array_slice($this->files, 1);
$this->finder $this->finder
@ -82,7 +82,7 @@ class CacheTest extends TestCase
$this->assertFileExists("{$this->root}/cached.file0.zip"); $this->assertFileExists("{$this->root}/cached.file0.zip");
} }
public function testRemoveFilesWhenCacheIsTooLarge() public function testRemoveFilesWhenCacheIsTooLarge(): void
{ {
$emptyFinder = $this->getMockBuilder('Symfony\Component\Finder\Finder')->disableOriginalConstructor()->getMock(); $emptyFinder = $this->getMockBuilder('Symfony\Component\Finder\Finder')->disableOriginalConstructor()->getMock();
$emptyFinder $emptyFinder
@ -111,7 +111,7 @@ class CacheTest extends TestCase
$this->assertFileExists("{$this->root}/cached.file3.zip"); $this->assertFileExists("{$this->root}/cached.file3.zip");
} }
public function testClearCache() public function testClearCache(): void
{ {
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$cache = new Cache($io, $this->root, 'a-z0-9.', $this->filesystem); $cache = new Cache($io, $this->root, 'a-z0-9.', $this->filesystem);

View File

@ -20,7 +20,7 @@ use Symfony\Component\Console\Input\ArrayInput;
class ArchiveCommandTest extends TestCase class ArchiveCommandTest extends TestCase
{ {
public function testUsesConfigFromComposerObject() public function testUsesConfigFromComposerObject(): void
{ {
$input = new ArrayInput(array()); $input = new ArrayInput(array());
@ -64,7 +64,7 @@ class ArchiveCommandTest extends TestCase
$command->run($input, $output); $command->run($input, $output);
} }
public function testUsesConfigFromFactoryWhenComposerIsNotDefined() public function testUsesConfigFromFactoryWhenComposerIsNotDefined(): void
{ {
$input = new ArrayInput(array()); $input = new ArrayInput(array());

View File

@ -17,7 +17,7 @@ use Composer\Test\TestCase;
class InitCommandTest extends TestCase class InitCommandTest extends TestCase
{ {
public function testParseValidAuthorString() public function testParseValidAuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString('John Smith <john@example.com>'); $author = $command->parseAuthorString('John Smith <john@example.com>');
@ -25,7 +25,7 @@ class InitCommandTest extends TestCase
$this->assertEquals('john@example.com', $author['email']); $this->assertEquals('john@example.com', $author['email']);
} }
public function testParseValidAuthorStringWithoutEmail() public function testParseValidAuthorStringWithoutEmail(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString('John Smith'); $author = $command->parseAuthorString('John Smith');
@ -33,7 +33,7 @@ class InitCommandTest extends TestCase
$this->assertNull($author['email']); $this->assertNull($author['email']);
} }
public function testParseValidUtf8AuthorString() public function testParseValidUtf8AuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString('Matti Meikäläinen <matti@example.com>'); $author = $command->parseAuthorString('Matti Meikäläinen <matti@example.com>');
@ -41,7 +41,7 @@ class InitCommandTest extends TestCase
$this->assertEquals('matti@example.com', $author['email']); $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 // \xCC\x88 is UTF-8 for U+0308 diaeresis (umlaut) combining mark
$utf8_expected = "Matti Meika\xCC\x88la\xCC\x88inen"; $utf8_expected = "Matti Meika\xCC\x88la\xCC\x88inen";
@ -51,7 +51,7 @@ class InitCommandTest extends TestCase
$this->assertEquals('matti@example.com', $author['email']); $this->assertEquals('matti@example.com', $author['email']);
} }
public function testParseNumericAuthorString() public function testParseNumericAuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString('h4x0r <h4x@example.com>'); $author = $command->parseAuthorString('h4x0r <h4x@example.com>');
@ -63,7 +63,7 @@ class InitCommandTest extends TestCase
* Test scenario for issue #5631 * Test scenario for issue #5631
* @link https://github.com/composer/composer/issues/5631 Issue #5631 * @link https://github.com/composer/composer/issues/5631 Issue #5631
*/ */
public function testParseValidAlias1AuthorString() public function testParseValidAlias1AuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString( $author = $command->parseAuthorString(
@ -77,7 +77,7 @@ class InitCommandTest extends TestCase
* Test scenario for issue #5631 * Test scenario for issue #5631
* @link https://github.com/composer/composer/issues/5631 Issue #5631 * @link https://github.com/composer/composer/issues/5631 Issue #5631
*/ */
public function testParseValidAlias2AuthorString() public function testParseValidAlias2AuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$author = $command->parseAuthorString( $author = $command->parseAuthorString(
@ -87,35 +87,35 @@ class InitCommandTest extends TestCase
$this->assertEquals('john@example.com', $author['email']); $this->assertEquals('john@example.com', $author['email']);
} }
public function testParseEmptyAuthorString() public function testParseEmptyAuthorString(): void
{ {
$command = new InitCommand; $command = new InitCommand;
self::expectException('InvalidArgumentException'); self::expectException('InvalidArgumentException');
$command->parseAuthorString(''); $command->parseAuthorString('');
} }
public function testParseAuthorStringWithInvalidEmail() public function testParseAuthorStringWithInvalidEmail(): void
{ {
$command = new InitCommand; $command = new InitCommand;
self::expectException('InvalidArgumentException'); self::expectException('InvalidArgumentException');
$command->parseAuthorString('John Smith <john>'); $command->parseAuthorString('John Smith <john>');
} }
public function testNamespaceFromValidPackageName() public function testNamespaceFromValidPackageName(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$namespace = $command->namespaceFromPackageName('new_projects.acme-extra/package-name'); $namespace = $command->namespaceFromPackageName('new_projects.acme-extra/package-name');
$this->assertEquals('NewProjectsAcmeExtra\PackageName', $namespace); $this->assertEquals('NewProjectsAcmeExtra\PackageName', $namespace);
} }
public function testNamespaceFromInvalidPackageName() public function testNamespaceFromInvalidPackageName(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$namespace = $command->namespaceFromPackageName('invalid-package-name'); $namespace = $command->namespaceFromPackageName('invalid-package-name');
$this->assertNull($namespace); $this->assertNull($namespace);
} }
public function testNamespaceFromMissingPackageName() public function testNamespaceFromMissingPackageName(): void
{ {
$command = new InitCommand; $command = new InitCommand;
$namespace = $command->namespaceFromPackageName(''); $namespace = $command->namespaceFromPackageName('');

View File

@ -24,7 +24,7 @@ class RunScriptCommandTest extends TestCase
* @param bool $dev * @param bool $dev
* @param bool $noDev * @param bool $noDev
*/ */
public function testDetectAndPassDevModeToEventAndToDispatching($dev, $noDev) public function testDetectAndPassDevModeToEventAndToDispatching($dev, $noDev): void
{ {
$scriptName = 'testScript'; $scriptName = 'testScript';

View File

@ -16,7 +16,7 @@ use Composer\Composer;
class ComposerTest extends TestCase class ComposerTest extends TestCase
{ {
public function testSetGetPackage() public function testSetGetPackage(): void
{ {
$composer = new Composer(); $composer = new Composer();
$package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock(); $package = $this->getMockBuilder('Composer\Package\RootPackageInterface')->getMock();
@ -25,7 +25,7 @@ class ComposerTest extends TestCase
$this->assertSame($package, $composer->getPackage()); $this->assertSame($package, $composer->getPackage());
} }
public function testSetGetLocker() public function testSetGetLocker(): void
{ {
$composer = new Composer(); $composer = new Composer();
$locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock(); $locker = $this->getMockBuilder('Composer\Package\Locker')->disableOriginalConstructor()->getMock();
@ -34,7 +34,7 @@ class ComposerTest extends TestCase
$this->assertSame($locker, $composer->getLocker()); $this->assertSame($locker, $composer->getLocker());
} }
public function testSetGetRepositoryManager() public function testSetGetRepositoryManager(): void
{ {
$composer = new Composer(); $composer = new Composer();
$manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock(); $manager = $this->getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()->getMock();
@ -43,7 +43,7 @@ class ComposerTest extends TestCase
$this->assertSame($manager, $composer->getRepositoryManager()); $this->assertSame($manager, $composer->getRepositoryManager());
} }
public function testSetGetDownloadManager() public function testSetGetDownloadManager(): void
{ {
$composer = new Composer(); $composer = new Composer();
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock(); $io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
@ -53,7 +53,7 @@ class ComposerTest extends TestCase
$this->assertSame($manager, $composer->getDownloadManager()); $this->assertSame($manager, $composer->getDownloadManager());
} }
public function testSetGetInstallationManager() public function testSetGetInstallationManager(): void
{ {
$composer = new Composer(); $composer = new Composer();
$manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock(); $manager = $this->getMockBuilder('Composer\Installer\InstallationManager')->disableOriginalConstructor()->getMock();

View File

@ -48,7 +48,7 @@ class JsonConfigSourceTest extends TestCase
} }
} }
public function testAddRepository() public function testAddRepository(): void
{ {
$config = $this->workingDir.'/composer.json'; $config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config); 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); $this->assertFileEquals($this->fixturePath('config/config-with-exampletld-repository.json'), $config);
} }
public function testAddRepositoryWithOptions() public function testAddRepositoryWithOptions(): void
{ {
$config = $this->workingDir.'/composer.json'; $config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config); 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); $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'; $config = $this->workingDir.'/composer.json';
copy($this->fixturePath('config/config-with-exampletld-repository.json'), $config); 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); $this->assertFileEquals($this->fixturePath('composer-repositories.json'), $config);
} }
public function testAddPackagistRepositoryWithFalseValue() public function testAddPackagistRepositoryWithFalseValue(): void
{ {
$config = $this->workingDir.'/composer.json'; $config = $this->workingDir.'/composer.json';
copy($this->fixturePath('composer-repositories.json'), $config); 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); $this->assertFileEquals($this->fixturePath('config/config-with-packagist-false.json'), $config);
} }
public function testRemovePackagist() public function testRemovePackagist(): void
{ {
$config = $this->workingDir.'/composer.json'; $config = $this->workingDir.'/composer.json';
copy($this->fixturePath('config/config-with-packagist-false.json'), $config); copy($this->fixturePath('config/config-with-packagist-false.json'), $config);
@ -117,7 +117,7 @@ class JsonConfigSourceTest extends TestCase
* *
* @dataProvider provideAddLinkData * @dataProvider provideAddLinkData
*/ */
public function testAddLink($sourceFile, $type, $name, $value, $compareAgainst) public function testAddLink($sourceFile, $type, $name, $value, $compareAgainst): void
{ {
$composerJson = $this->workingDir.'/composer.json'; $composerJson = $this->workingDir.'/composer.json';
copy($sourceFile, $composerJson); copy($sourceFile, $composerJson);
@ -138,7 +138,7 @@ class JsonConfigSourceTest extends TestCase
* *
* @dataProvider provideRemoveLinkData * @dataProvider provideRemoveLinkData
*/ */
public function testRemoveLink($sourceFile, $type, $name, $compareAgainst) public function testRemoveLink($sourceFile, $type, $name, $compareAgainst): void
{ {
$composerJson = $this->workingDir.'/composer.json'; $composerJson = $this->workingDir.'/composer.json';
copy($sourceFile, $composerJson); copy($sourceFile, $composerJson);

View File

@ -23,7 +23,7 @@ class ConfigTest extends TestCase
* @param mixed[] $localConfig * @param mixed[] $localConfig
* @param ?mixed[] $systemConfig * @param ?mixed[] $systemConfig
*/ */
public function testAddPackagistRepository($expected, $localConfig, $systemConfig = null) public function testAddPackagistRepository($expected, $localConfig, $systemConfig = null): void
{ {
$config = new Config(false); $config = new Config(false);
if ($systemConfig) { if ($systemConfig) {
@ -141,7 +141,7 @@ class ConfigTest extends TestCase
return $data; return $data;
} }
public function testPreferredInstallAsString() public function testPreferredInstallAsString(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('preferred-install' => 'source'))); $config->merge(array('config' => array('preferred-install' => 'source')));
@ -150,7 +150,7 @@ class ConfigTest extends TestCase
$this->assertEquals('dist', $config->get('preferred-install')); $this->assertEquals('dist', $config->get('preferred-install'));
} }
public function testMergePreferredInstall() public function testMergePreferredInstall(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('preferred-install' => 'dist'))); $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')); $this->assertEquals(array('foo/*' => 'source', '*' => 'dist'), $config->get('preferred-install'));
} }
public function testMergeGithubOauth() public function testMergeGithubOauth(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('github-oauth' => array('foo' => 'bar')))); $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')); $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz'), $config->get('github-oauth'));
} }
public function testVarReplacement() public function testVarReplacement(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('a' => 'b', 'c' => '{$a}'))); $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')); $this->assertEquals($home.'/foo', $config->get('cache-dir'));
} }
public function testRealpathReplacement() public function testRealpathReplacement(): void
{ {
$config = new Config(false, '/foo/bar'); $config = new Config(false, '/foo/bar');
$config->merge(array('config' => array( $config->merge(array('config' => array(
@ -198,7 +198,7 @@ class ConfigTest extends TestCase
$this->assertEquals('/baz', $config->get('cache-dir')); $this->assertEquals('/baz', $config->get('cache-dir'));
} }
public function testStreamWrapperDirs() public function testStreamWrapperDirs(): void
{ {
$config = new Config(false, '/foo/bar'); $config = new Config(false, '/foo/bar');
$config->merge(array('config' => array( $config->merge(array('config' => array(
@ -208,7 +208,7 @@ class ConfigTest extends TestCase
$this->assertEquals('s3://baz', $config->get('cache-dir')); $this->assertEquals('s3://baz', $config->get('cache-dir'));
} }
public function testFetchingRelativePaths() public function testFetchingRelativePaths(): void
{ {
$config = new Config(false, '/foo/bar'); $config = new Config(false, '/foo/bar');
$config->merge(array('config' => array( $config->merge(array('config' => array(
@ -222,7 +222,7 @@ class ConfigTest extends TestCase
$this->assertEquals('vendor/foo', $config->get('bin-dir', Config::RELATIVE_PATHS)); $this->assertEquals('vendor/foo', $config->get('bin-dir', Config::RELATIVE_PATHS));
} }
public function testOverrideGithubProtocols() public function testOverrideGithubProtocols(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('github-protocols' => array('https', 'ssh')))); $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')); $this->assertEquals(array('https'), $config->get('github-protocols'));
} }
public function testGitDisabledByDefaultInGithubProtocols() public function testGitDisabledByDefaultInGithubProtocols(): void
{ {
$config = new Config(false); $config = new Config(false);
$config->merge(array('config' => array('github-protocols' => array('https', 'git')))); $config->merge(array('config' => array('github-protocols' => array('https', 'git'))));
@ -247,7 +247,7 @@ class ConfigTest extends TestCase
* *
* @param string $url * @param string $url
*/ */
public function testAllowedUrlsPass($url) public function testAllowedUrlsPass($url): void
{ {
$config = new Config(false); $config = new Config(false);
$config->prohibitUrlByConfig($url); $config->prohibitUrlByConfig($url);
@ -258,7 +258,7 @@ class ConfigTest extends TestCase
* *
* @param string $url * @param string $url
*/ */
public function testProhibitedUrlsThrowException($url) public function testProhibitedUrlsThrowException($url): void
{ {
self::expectException('Composer\Downloader\TransportException'); self::expectException('Composer\Downloader\TransportException');
self::expectExceptionMessage('Your configuration does not allow connections to ' . $url); self::expectExceptionMessage('Your configuration does not allow connections to ' . $url);
@ -311,7 +311,7 @@ class ConfigTest extends TestCase
/** /**
* @group TLS * @group TLS
*/ */
public function testDisableTlsCanBeOverridden() public function testDisableTlsCanBeOverridden(): void
{ {
$config = new Config; $config = new Config;
$config->merge( $config->merge(
@ -324,7 +324,7 @@ class ConfigTest extends TestCase
$this->assertTrue($config->get('disable-tls')); $this->assertTrue($config->get('disable-tls'));
} }
public function testProcessTimeout() public function testProcessTimeout(): void
{ {
Platform::putEnv('COMPOSER_PROCESS_TIMEOUT', '0'); Platform::putEnv('COMPOSER_PROCESS_TIMEOUT', '0');
$config = new Config(true); $config = new Config(true);
@ -334,7 +334,7 @@ class ConfigTest extends TestCase
$this->assertEquals(0, $result); $this->assertEquals(0, $result);
} }
public function testHtaccessProtect() public function testHtaccessProtect(): void
{ {
Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0');
$config = new Config(true); $config = new Config(true);
@ -344,7 +344,7 @@ class ConfigTest extends TestCase
$this->assertEquals(0, $result); $this->assertEquals(0, $result);
} }
public function testGetSourceOfValue() public function testGetSourceOfValue(): void
{ {
Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT'); Platform::clearEnv('COMPOSER_PROCESS_TIMEOUT');
@ -360,7 +360,7 @@ class ConfigTest extends TestCase
$this->assertSame('phpunit-test', $config->getSourceOfValue('process-timeout')); $this->assertSame('phpunit-test', $config->getSourceOfValue('process-timeout'));
} }
public function testGetSourceOfValueEnvVariables() public function testGetSourceOfValueEnvVariables(): void
{ {
Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0'); Platform::putEnv('COMPOSER_HTACCESS_PROTECT', '0');
$config = new Config; $config = new Config;

View File

@ -18,7 +18,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class HtmlOutputFormatterTest extends TestCase class HtmlOutputFormatterTest extends TestCase
{ {
public function testFormatting() public function testFormatting(): void
{ {
$formatter = new HtmlOutputFormatter(array( $formatter = new HtmlOutputFormatter(array(
'warning' => new OutputFormatterStyle('black', 'yellow'), 'warning' => new OutputFormatterStyle('black', 'yellow'),

View File

@ -19,7 +19,7 @@ class DefaultConfigTest extends TestCase
/** /**
* @group TLS * @group TLS
*/ */
public function testDefaultValuesAreAsExpected() public function testDefaultValuesAreAsExpected(): void
{ {
$config = new Config; $config = new Config;
$this->assertFalse($config->get('disable-tls')); $this->assertFalse($config->get('disable-tls'));

Some files were not shown because too many files have changed in this diff Show More