diff --git a/composer.json b/composer.json index d4cb8e9a3..2cbbc6aac 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "composer/pcre": "^1.0" }, "require-dev": { - "symfony/phpunit-bridge": "^5.4 || ^6.0", + "symfony/phpunit-bridge": "^6.0", "phpspec/prophecy": "^1.10", "phpstan/phpstan": "^1.0", "phpstan/phpstan-phpunit": "^1.0", @@ -84,10 +84,7 @@ ], "scripts": { "compile": "@php -dphar.readonly=0 bin/compile", - "test": [ - "@putenv SYMFONY_PHPUNIT_VERSION=8.5", - "@php simple-phpunit" - ], + "test": "@php simple-phpunit", "phpstan": "@php vendor/bin/phpstan analyse --configuration=phpstan/config.neon" }, "scripts-descriptions": { diff --git a/composer.lock b/composer.lock index 3b94b9783..a8a5857b0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b75018840aa186f02f947abb15a39369", + "content-hash": "84679af67d11fbadffda53328d7fe1b7", "packages": [ { "name": "composer/ca-bundle", @@ -3799,5 +3799,5 @@ "platform-overrides": { "php": "7.2.5" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.1.0" } diff --git a/src/Composer/Command/GlobalCommand.php b/src/Composer/Command/GlobalCommand.php index ad629de4b..91aae03f0 100644 --- a/src/Composer/Command/GlobalCommand.php +++ b/src/Composer/Command/GlobalCommand.php @@ -62,10 +62,9 @@ EOT } /** - * @return int|void * @throws \Symfony\Component\Console\Exception\ExceptionInterface */ - public function run(InputInterface $input, OutputInterface $output) + public function run(InputInterface $input, OutputInterface $output): int { if (!method_exists($input, '__toString')) { throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input)); diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index b5af14af8..cc9f08685 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -119,10 +119,7 @@ class Application extends BaseApplication parent::__construct('Composer', Composer::getVersion()); } - /** - * @return int - */ - public function run(InputInterface $input = null, OutputInterface $output = null) + public function run(InputInterface $input = null, OutputInterface $output = null): int { if (null === $output) { $output = Factory::createOutput(); @@ -131,10 +128,7 @@ class Application extends BaseApplication return parent::run($input, $output); } - /** - * @return int - */ - public function doRun(InputInterface $input, OutputInterface $output) + public function doRun(InputInterface $input, OutputInterface $output): int { $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins'); $this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts'); @@ -483,10 +477,7 @@ class Application extends BaseApplication return $this->io; } - /** - * @return string - */ - public function getHelp() + public function getHelp(): string { return self::$logo . parent::getHelp(); } @@ -495,7 +486,7 @@ class Application extends BaseApplication * Initializes all the composer commands. * @return \Symfony\Component\Console\Command\Command[] */ - protected function getDefaultCommands() + protected function getDefaultCommands(): array { $commands = array_merge(parent::getDefaultCommands(), array( new Command\AboutCommand(), @@ -535,10 +526,7 @@ class Application extends BaseApplication return $commands; } - /** - * @return string - */ - public function getLongVersion() + public function getLongVersion(): string { if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') { return sprintf( @@ -553,10 +541,7 @@ class Application extends BaseApplication return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE; } - /** - * @return InputDefinition - */ - protected function getDefaultInputDefinition() + protected function getDefaultInputDefinition(): InputDefinition { $definition = parent::getDefaultInputDefinition(); $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information')); diff --git a/src/Composer/Console/HtmlOutputFormatter.php b/src/Composer/Console/HtmlOutputFormatter.php index 7fc0876ec..fcb8fab4b 100644 --- a/src/Composer/Console/HtmlOutputFormatter.php +++ b/src/Composer/Console/HtmlOutputFormatter.php @@ -60,12 +60,7 @@ class HtmlOutputFormatter extends OutputFormatter parent::__construct(true, $styles); } - /** - * @param ?string $message - * - * @return string - */ - public function format($message) + public function format(?string $message): ?string { $formatted = parent::format($message); diff --git a/src/Composer/IO/BaseIO.php b/src/Composer/IO/BaseIO.php index 24a0c3b62..33cc14eef 100644 --- a/src/Composer/IO/BaseIO.php +++ b/src/Composer/IO/BaseIO.php @@ -159,74 +159,47 @@ abstract class BaseIO implements IOInterface ProcessExecutor::setTimeout((int) $config->get('process-timeout')); } - /** - * @return void - */ - public function emergency($message, array $context = array()) + public function emergency($message, array $context = array()): void { $this->log(LogLevel::EMERGENCY, $message, $context); } - /** - * @return void - */ - public function alert($message, array $context = array()) + public function alert($message, array $context = array()): void { $this->log(LogLevel::ALERT, $message, $context); } - /** - * @return void - */ - public function critical($message, array $context = array()) + public function critical($message, array $context = array()): void { $this->log(LogLevel::CRITICAL, $message, $context); } - /** - * @return void - */ - public function error($message, array $context = array()) + public function error($message, array $context = array()): void { $this->log(LogLevel::ERROR, $message, $context); } - /** - * @return void - */ - public function warning($message, array $context = array()) + public function warning($message, array $context = array()): void { $this->log(LogLevel::WARNING, $message, $context); } - /** - * @return void - */ - public function notice($message, array $context = array()) + public function notice($message, array $context = array()): void { $this->log(LogLevel::NOTICE, $message, $context); } - /** - * @return void - */ - public function info($message, array $context = array()) + public function info($message, array $context = array()): void { $this->log(LogLevel::INFO, $message, $context); } - /** - * @return void - */ - public function debug($message, array $context = array()) + public function debug($message, array $context = array()): void { $this->log(LogLevel::DEBUG, $message, $context); } - /** - * @return void - */ - public function log($level, $message, array $context = array()) + public function log($level, $message, array $context = array()): void { if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) { $this->writeError(''.$message.''); diff --git a/tests/Composer/Test/Downloader/ZipDownloaderTest.php b/tests/Composer/Test/Downloader/ZipDownloaderTest.php index 7e1f33119..3885a33e6 100644 --- a/tests/Composer/Test/Downloader/ZipDownloaderTest.php +++ b/tests/Composer/Test/Downloader/ZipDownloaderTest.php @@ -114,11 +114,11 @@ class ZipDownloaderTest extends TestCase $this->setPrivateProperty('hasZipArchive', true); $downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader); - $zipArchive = $this->getMockBuilder('ZipArchive')->getMock(); - $zipArchive->expects($this->at(0)) + $zipArchive = $this->getMockBuilder('ZipArchive')->onlyMethods(['open', 'extractTo'])->getMock(); + $zipArchive->expects($this->once()) ->method('open') ->will($this->returnValue(true)); - $zipArchive->expects($this->at(1)) + $zipArchive->expects($this->once()) ->method('extractTo') ->will($this->returnValue(false));