1
0
Fork 0

Remove obsolete Symfony feature detections (#10425)

pull/10428/head
Alexander M. Turek 2022-01-04 10:41:33 +01:00 committed by GitHub
parent 1c928466a9
commit 36da81bec2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 30 deletions

View File

@ -97,7 +97,7 @@ class ConsoleIO extends BaseIO
*/ */
public function isVerbose() public function isVerbose()
{ {
return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE; return $this->output->isVerbose();
} }
/** /**
@ -105,7 +105,7 @@ class ConsoleIO extends BaseIO
*/ */
public function isVeryVerbose() public function isVeryVerbose()
{ {
return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE; return $this->output->isVeryVerbose();
} }
/** /**
@ -113,7 +113,7 @@ class ConsoleIO extends BaseIO
*/ */
public function isDebug() public function isDebug()
{ {
return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG; return $this->output->isDebug();
} }
/** /**

View File

@ -118,13 +118,7 @@ class ProcessExecutor
$this->captureOutput = func_num_args() > 3; $this->captureOutput = func_num_args() > 3;
$this->errorOutput = ''; $this->errorOutput = '';
// TODO in v3, commands should be passed in as arrays of cmd + args $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
} else {
/** @phpstan-ignore-next-line */
$process = new Process($command, $cwd, null, null, static::getTimeout());
}
if (!Platform::isWindows() && $tty) { if (!Platform::isWindows() && $tty) {
try { try {
$process->setTty(true); $process->setTty(true);
@ -249,12 +243,7 @@ class ProcessExecutor
} }
try { try {
// TODO in v3, commands should be passed in as arrays of cmd + args $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
$process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
} else {
$process = new Process($command, $cwd, null, null, static::getTimeout());
}
} catch (\Throwable $e) { } catch (\Throwable $e) {
call_user_func($job['reject'], $e); call_user_func($job['reject'], $e);

View File

@ -281,12 +281,7 @@ class ArchivableFilesFinderTest extends TestCase
*/ */
protected function getArchivedFiles($command) protected function getArchivedFiles($command)
{ {
if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) { $process = Process::fromShellCommandline($command, $this->sources);
$process = Process::fromShellCommandline($command, $this->sources);
} else {
// @phpstan-ignore-next-line symfony/process 2.8 accepts a string but not 5.3 which is used only for PHPStan
$process = new Process($command, $this->sources);
}
$process->run(); $process->run();
$archive = new \PharData($this->sources.'/archive.zip'); $archive = new \PharData($this->sources.'/archive.zip');

View File

@ -134,16 +134,10 @@ class StrictConfirmationQuestionTest extends TestCase
*/ */
protected function createInput($entry) protected function createInput($entry)
{ {
$stream = $this->getInputStream($entry);
$input = new ArrayInput(array('--no-interaction')); $input = new ArrayInput(array('--no-interaction'));
$dialog = new QuestionHelper(); $input->setStream($this->getInputStream($entry));
if (method_exists($dialog, 'setInputStream')) { $dialog = new QuestionHelper();
$dialog->setInputStream($stream);
}
if ($input instanceof StreamableInputInterface) {
$input->setStream($stream);
}
return array($input, $dialog); return array($input, $dialog);
} }