Fix Symfony6 compat

main
Jordi Boggiano 2 years ago
parent 2a771dfb2d
commit bf72afec44
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -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": {

4
composer.lock generated

@ -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"
}

@ -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));

@ -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'));

@ -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);

@ -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('<error>'.$message.'</error>');

@ -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));

Loading…
Cancel
Save