Fix Symfony6 compat
parent
2a771dfb2d
commit
bf72afec44
|
@ -40,7 +40,7 @@
|
||||||
"composer/pcre": "^1.0"
|
"composer/pcre": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/phpunit-bridge": "^5.4 || ^6.0",
|
"symfony/phpunit-bridge": "^6.0",
|
||||||
"phpspec/prophecy": "^1.10",
|
"phpspec/prophecy": "^1.10",
|
||||||
"phpstan/phpstan": "^1.0",
|
"phpstan/phpstan": "^1.0",
|
||||||
"phpstan/phpstan-phpunit": "^1.0",
|
"phpstan/phpstan-phpunit": "^1.0",
|
||||||
|
@ -84,10 +84,7 @@
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "@php -dphar.readonly=0 bin/compile",
|
"compile": "@php -dphar.readonly=0 bin/compile",
|
||||||
"test": [
|
"test": "@php simple-phpunit",
|
||||||
"@putenv SYMFONY_PHPUNIT_VERSION=8.5",
|
|
||||||
"@php simple-phpunit"
|
|
||||||
],
|
|
||||||
"phpstan": "@php vendor/bin/phpstan analyse --configuration=phpstan/config.neon"
|
"phpstan": "@php vendor/bin/phpstan analyse --configuration=phpstan/config.neon"
|
||||||
},
|
},
|
||||||
"scripts-descriptions": {
|
"scripts-descriptions": {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "b75018840aa186f02f947abb15a39369",
|
"content-hash": "84679af67d11fbadffda53328d7fe1b7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "composer/ca-bundle",
|
"name": "composer/ca-bundle",
|
||||||
|
@ -3799,5 +3799,5 @@
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "7.2.5"
|
"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
|
* @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')) {
|
if (!method_exists($input, '__toString')) {
|
||||||
throw new \LogicException('Expected an Input instance that is stringable, got '.get_class($input));
|
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());
|
parent::__construct('Composer', Composer::getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function run(InputInterface $input = null, OutputInterface $output = null): int
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function run(InputInterface $input = null, OutputInterface $output = null)
|
|
||||||
{
|
{
|
||||||
if (null === $output) {
|
if (null === $output) {
|
||||||
$output = Factory::createOutput();
|
$output = Factory::createOutput();
|
||||||
|
@ -131,10 +128,7 @@ class Application extends BaseApplication
|
||||||
return parent::run($input, $output);
|
return parent::run($input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function doRun(InputInterface $input, OutputInterface $output): int
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function doRun(InputInterface $input, OutputInterface $output)
|
|
||||||
{
|
{
|
||||||
$this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
|
$this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
|
||||||
$this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
|
$this->disableScriptsByDefault = $input->hasParameterOption('--no-scripts');
|
||||||
|
@ -483,10 +477,7 @@ class Application extends BaseApplication
|
||||||
return $this->io;
|
return $this->io;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getHelp(): string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getHelp()
|
|
||||||
{
|
{
|
||||||
return self::$logo . parent::getHelp();
|
return self::$logo . parent::getHelp();
|
||||||
}
|
}
|
||||||
|
@ -495,7 +486,7 @@ class Application extends BaseApplication
|
||||||
* Initializes all the composer commands.
|
* Initializes all the composer commands.
|
||||||
* @return \Symfony\Component\Console\Command\Command[]
|
* @return \Symfony\Component\Console\Command\Command[]
|
||||||
*/
|
*/
|
||||||
protected function getDefaultCommands()
|
protected function getDefaultCommands(): array
|
||||||
{
|
{
|
||||||
$commands = array_merge(parent::getDefaultCommands(), array(
|
$commands = array_merge(parent::getDefaultCommands(), array(
|
||||||
new Command\AboutCommand(),
|
new Command\AboutCommand(),
|
||||||
|
@ -535,10 +526,7 @@ class Application extends BaseApplication
|
||||||
return $commands;
|
return $commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getLongVersion(): string
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLongVersion()
|
|
||||||
{
|
{
|
||||||
if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
|
if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
@ -553,10 +541,7 @@ class Application extends BaseApplication
|
||||||
return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
|
return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected function getDefaultInputDefinition(): InputDefinition
|
||||||
* @return InputDefinition
|
|
||||||
*/
|
|
||||||
protected function getDefaultInputDefinition()
|
|
||||||
{
|
{
|
||||||
$definition = parent::getDefaultInputDefinition();
|
$definition = parent::getDefaultInputDefinition();
|
||||||
$definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
|
$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);
|
parent::__construct(true, $styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function format(?string $message): ?string
|
||||||
* @param ?string $message
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function format($message)
|
|
||||||
{
|
{
|
||||||
$formatted = parent::format($message);
|
$formatted = parent::format($message);
|
||||||
|
|
||||||
|
|
|
@ -159,74 +159,47 @@ abstract class BaseIO implements IOInterface
|
||||||
ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
|
ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function emergency($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function emergency($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::EMERGENCY, $message, $context);
|
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function alert($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function alert($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::ALERT, $message, $context);
|
$this->log(LogLevel::ALERT, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function critical($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function critical($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::CRITICAL, $message, $context);
|
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function error($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function error($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::ERROR, $message, $context);
|
$this->log(LogLevel::ERROR, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function warning($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function warning($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::WARNING, $message, $context);
|
$this->log(LogLevel::WARNING, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function notice($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function notice($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::NOTICE, $message, $context);
|
$this->log(LogLevel::NOTICE, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function info($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function info($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::INFO, $message, $context);
|
$this->log(LogLevel::INFO, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function debug($message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function debug($message, array $context = array())
|
|
||||||
{
|
{
|
||||||
$this->log(LogLevel::DEBUG, $message, $context);
|
$this->log(LogLevel::DEBUG, $message, $context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function log($level, $message, array $context = array()): void
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function log($level, $message, array $context = array())
|
|
||||||
{
|
{
|
||||||
if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
|
if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
|
||||||
$this->writeError('<error>'.$message.'</error>');
|
$this->writeError('<error>'.$message.'</error>');
|
||||||
|
|
|
@ -114,11 +114,11 @@ class ZipDownloaderTest extends TestCase
|
||||||
|
|
||||||
$this->setPrivateProperty('hasZipArchive', true);
|
$this->setPrivateProperty('hasZipArchive', true);
|
||||||
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
|
$downloader = new MockedZipDownloader($this->io, $this->config, $this->httpDownloader);
|
||||||
$zipArchive = $this->getMockBuilder('ZipArchive')->getMock();
|
$zipArchive = $this->getMockBuilder('ZipArchive')->onlyMethods(['open', 'extractTo'])->getMock();
|
||||||
$zipArchive->expects($this->at(0))
|
$zipArchive->expects($this->once())
|
||||||
->method('open')
|
->method('open')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
$zipArchive->expects($this->at(1))
|
$zipArchive->expects($this->once())
|
||||||
->method('extractTo')
|
->method('extractTo')
|
||||||
->will($this->returnValue(false));
|
->will($this->returnValue(false));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue