Skip to content

Upgrading symfony/console 3 to 4

Breakingv3.4.47 → v4.4.49Breaking5Deprecated5New13Changed3Fixed56

BreakingUpgrade verdict

5 breaking changes.

  • Two methods for setting or reading the input stream on the question helper are gone.
  • The application no longer exposes methods for reading or setting terminal size.
  • The event object that used to be dispatched on console exceptions no longer exists.
  • The exception event constant is gone, so listeners can no longer subscribe to it.
Top 5 of 10 that need code or config changes

PHP requirement changed in v4.4.9: ^5.5.9|>=7.0.8 → >=7.1.3.

Breaking5
Removes QuestionHelper::setInputStream() and QuestionHelper::getInputStream().
QuestionHelper::setInputStream()QuestionHelper::getInputStream()
Removes Application::getTerminalWidth()/getTerminalHeight() and Application::setTerminalDimensions()/getTerminalDimensions().
Application::getTerminalWidth()Application::getTerminalHeight()Application::setTerminalDimensions()Application::getTerminalDimensions()
Removes the ConsoleExceptionEvent class.
ConsoleExceptionEvent
Removes the ConsoleEvents::EXCEPTION event constant.
ConsoleEvents::EXCEPTION
Makes the ProcessHelper class final.
ProcessHelper
Deprecated5
Deprecates finding hidden commands using an abbreviation; use the full name instead.
Marks all dispatched event classes as @final.
Deprecates returning null from Command::execute(); return 0 instead.
Command::execute()
Deprecates Application::renderException() and Application::doRenderException() in favor of renderThrowable() and doRenderThrowable().
Application::renderException()Application::doRenderException()Application::renderThrowable()Application::doRenderThrowable()
Deprecates passing a command as a string to ProcessHelper::run(); pass it as an array of arguments instead.
ProcessHelper::run()

Generated by DepDelta from published PHP source. Not mixed with prose notes.

  • removed: const ConsoleEvents.EXCEPTION
  • removed: method Application.getTerminalDimensions()
  • removed: method Application.setTerminalDimensions($width, $height)
  • removed: protected method Application.getTerminalHeight()
  • removed: protected method Application.getTerminalWidth()
  • changed: class Application → class Application implements ResetInterface
  • changed: constructor Application($name = …, $version = …) → constructor Application(string $name = …, string $version = …)
  • changed: method Application.isSingleCommand() → method Application.isSingleCommand(): bool
  • added: method Application.renderThrowable(\Throwable $e, OutputInterface $output): void
  • added: method Application.reset()
  • added: protected method Application.doRenderThrowable(\Throwable $e, OutputInterface $output): void
  • changed: constructor Command($name = …) → constructor Command(string $name = …)
  • changed: constructor AddConsoleCommandPass($commandLoaderServiceId = …, $commandTag = …) → constructor AddConsoleCommandPass(string $commandLoaderServiceId = …, string $commandTag = …)
  • changed: constructor ApplicationDescription(Application $application, $namespace = …, $showHidden = …) → constructor ApplicationDescription(Application $application, string $namespace = …, bool $showHidden = …)
  • changed: method ApplicationDescription.getCommand($name) → method ApplicationDescription.getCommand(string $name): Command
  • changed: method ApplicationDescription.getCommands() → method ApplicationDescription.getCommands(): array
  • changed: method ApplicationDescription.getNamespaces() → method ApplicationDescription.getNamespaces(): array
  • changed: method XmlDescriptor.getApplicationDocument(Application $application, $namespace = …) → method XmlDescriptor.getApplicationDocument(Application $application, string $namespace = …): \DOMDocument
  • changed: method XmlDescriptor.getCommandDocument(Command $command) → method XmlDescriptor.getCommandDocument(Command $command): \DOMDocument
  • changed: method XmlDescriptor.getInputDefinitionDocument(InputDefinition $definition) → method XmlDescriptor.getInputDefinitionDocument(InputDefinition $definition): \DOMDocument
  • removed: class ConsoleExceptionEvent extends ConsoleEvent
  • removed: constructor ConsoleExceptionEvent(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  • removed: method ConsoleExceptionEvent.getException()
  • removed: method ConsoleExceptionEvent.getExitCode()
  • removed: method ConsoleExceptionEvent.setException(\Exception $exception)
  • changed: constructor ConsoleErrorEvent(InputInterface $input, OutputInterface $output, $error, Command $command = …) → constructor ConsoleErrorEvent(InputInterface $input, OutputInterface $output, \Throwable $error, Command $command = …)
  • changed: constructor ConsoleEvent(Command $command = …, InputInterface $input, OutputInterface $output) → constructor ConsoleEvent(?Command $command, InputInterface $input, OutputInterface $output)
  • changed: constructor ConsoleTerminateEvent(Command $command, InputInterface $input, OutputInterface $output, $exitCode) → constructor ConsoleTerminateEvent(Command $command, InputInterface $input, OutputInterface $output, int $exitCode)
  • changed: method ConsoleErrorEvent.getError() → method ConsoleErrorEvent.getError(): \Throwable
  • changed: method ConsoleErrorEvent.getExitCode() → method ConsoleErrorEvent.getExitCode(): int
  • changed: method ConsoleErrorEvent.setError($error) → method ConsoleErrorEvent.setError(\Throwable $error): void
  • changed: method ConsoleErrorEvent.setExitCode($exitCode) → method ConsoleErrorEvent.setExitCode(int $exitCode): void
  • changed: constructor CommandNotFoundException($message, array $alternatives = …, $code = …, \Exception $previous = …) → constructor CommandNotFoundException(string $message, array $alternatives = …, int $code = …, \Throwable $previous = …)
  • changed: interface ExceptionInterface → interface ExceptionInterface extends \Throwable
  • added: class MissingInputException extends RuntimeException implements ExceptionInterface
  • added: class NamespaceNotFoundException extends CommandNotFoundException
  • changed: class OutputFormatter implements OutputFormatterInterface → class OutputFormatter implements WrappableOutputFormatterInterface
  • changed: class OutputFormatterStyleStack → class OutputFormatterStyleStack implements ResetInterface
  • changed: constructor OutputFormatter($decorated = …, array $styles = …) → constructor OutputFormatter(bool $decorated = …, array $styles = …)
  • changed: constructor OutputFormatterStyle($foreground = …, $background = …, array $options = …) → constructor OutputFormatterStyle(string $foreground = …, string $background = …, array $options = …)
  • changed: static method OutputFormatter.escapeTrailingBackslash($text) → static method OutputFormatter.escapeTrailingBackslash(string $text): string
  • added: interface WrappableOutputFormatterInterface extends OutputFormatterInterface
  • added: method OutputFormatter.__clone()
  • added: method OutputFormatter.formatAndWrap(string $message, int $width)
  • added: method OutputFormatterStyle.setHref(string $url): void
  • added: method WrappableOutputFormatterInterface.formatAndWrap(string $message, int $width)
  • removed: method QuestionHelper.getInputStream()
  • removed: method QuestionHelper.setInputStream($stream)
  • removed: method SymfonyQuestionHelper.ask(InputInterface $input, OutputInterface $output, Question $question)
  • changed: constructor ProgressBar(OutputInterface $output, $max = …) → constructor ProgressBar(OutputInterface $output, int $max = …, float $minSecondsBetweenRedraws = …)
  • changed: constructor ProgressIndicator(OutputInterface $output, $format = …, $indicatorChangeInterval = …, $indicatorValues = …) → constructor ProgressIndicator(OutputInterface $output, string $format = …, int $indicatorChangeInterval = …, array $indicatorValues = …)
  • changed: constructor TableCell($value = …, array $options = …) → constructor TableCell(string $value = …, array $options = …)
  • changed: method ProgressBar.advance($step = …) → method ProgressBar.advance(int $step = …)
  • changed: method ProgressBar.clear() → method ProgressBar.clear(): void
  • changed: method ProgressBar.display() → method ProgressBar.display(): void
  • changed: method ProgressBar.finish() → method ProgressBar.finish(): void
  • changed: method ProgressBar.getBarCharacter() → method ProgressBar.getBarCharacter(): string
  • changed: method ProgressBar.getBarWidth() → method ProgressBar.getBarWidth(): int
  • changed: method ProgressBar.getEmptyBarCharacter() → method ProgressBar.getEmptyBarCharacter(): string
  • changed: method ProgressBar.getMaxSteps() → method ProgressBar.getMaxSteps(): int
  • changed: method ProgressBar.getMessage($name = …) → method ProgressBar.getMessage(string $name = …)
  • changed: method ProgressBar.getProgress() → method ProgressBar.getProgress(): int
  • changed: method ProgressBar.getProgressCharacter() → method ProgressBar.getProgressCharacter(): string
  • changed: method ProgressBar.getProgressPercent() → method ProgressBar.getProgressPercent(): float
  • changed: method ProgressBar.getStartTime() → method ProgressBar.getStartTime(): int
  • changed: method ProgressBar.setBarCharacter($char) → method ProgressBar.setBarCharacter(string $char)
  • changed: method ProgressBar.setBarWidth($size) → method ProgressBar.setBarWidth(int $size)
  • changed: method ProgressBar.setEmptyBarCharacter($char) → method ProgressBar.setEmptyBarCharacter(string $char)
  • changed: method ProgressBar.setFormat($format) → method ProgressBar.setFormat(string $format)
  • changed: method ProgressBar.setMessage($message, $name = …) → method ProgressBar.setMessage(string $message, string $name = …)
  • changed: method ProgressBar.setOverwrite($overwrite) → method ProgressBar.setOverwrite(bool $overwrite)
  • changed: method ProgressBar.setProgress($step) → method ProgressBar.setProgress(int $step)
  • changed: method ProgressBar.setProgressCharacter($char) → method ProgressBar.setProgressCharacter(string $char)
  • changed: method ProgressBar.setRedrawFrequency($freq) → method ProgressBar.setRedrawFrequency(?int $freq)
  • changed: method ProgressBar.start($max = …) → method ProgressBar.start(int $max = …)
  • changed: static method ProgressBar.getFormatDefinition($name) → static method ProgressBar.getFormatDefinition(string $name): ?string
  • changed: static method ProgressBar.getPlaceholderFormatterDefinition($name) → static method ProgressBar.getPlaceholderFormatterDefinition(string $name): ?callable
  • changed: static method ProgressBar.setFormatDefinition($name, $format) → static method ProgressBar.setFormatDefinition(string $name, string $format): void
  • changed: static method ProgressBar.setPlaceholderFormatterDefinition($name, callable $callable) → static method ProgressBar.setPlaceholderFormatterDefinition(string $name, callable $callable): void
  • added: class TableRows implements \IteratorAggregate
  • added: constructor Dumper(OutputInterface $output, CliDumper $dumper = …, ClonerInterface $cloner = …)
  • added: constructor TableRows(callable $generator)
  • added: final class Dumper
  • added: method Dumper.__invoke($var): string
  • added: method ProgressBar.getBarOffset(): int
  • added: method ProgressBar.iterate(iterable $iterable, int $max = …): iterable
  • added: method ProgressBar.maxSecondsBetweenRedraws(float $seconds): void
  • added: method ProgressBar.minSecondsBetweenRedraws(float $seconds): void
  • added: method ProgressBar.setMaxSteps(int $max)
  • added: method Table.appendRow($row): self
  • added: method Table.setColumnMaxWidth(int $columnIndex, int $width): self
  • added: method Table.setFooterTitle(?string $title): self
  • added: method Table.setHeaderTitle(?string $title): self
  • added: method Table.setHorizontal(bool $horizontal = …): self
  • added: method TableRows.getIterator(): \Traversable
  • added: method TableStyle.getBorderChars(): array
  • added: method TableStyle.getCrossingChars(): array
  • added: method TableStyle.getFooterTitleFormat(): string
  • added: method TableStyle.getHeaderTitleFormat(): string
  • added: method TableStyle.setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, string $topLeftBottom = …, string $topMidBottom = …, string $topRightBottom = …): self
  • added: method TableStyle.setDefaultCrossingChar(string $char): self
  • added: method TableStyle.setFooterTitleFormat(string $format): self
  • added: method TableStyle.setHeaderTitleFormat(string $format): self
  • added: method TableStyle.setHorizontalBorderChars(string $outside, string $inside = …): self
  • added: method TableStyle.setVerticalBorderChars(string $outside, string $inside = …): self
  • changed: constructor InputArgument($name, $mode = …, $description = …, $default = …) → constructor InputArgument(string $name, int $mode = …, string $description = …, $default = …)
  • changed: constructor InputOption($name, $shortcut = …, $mode = …, $description = …, $default = …) → constructor InputOption(string $name, $shortcut = …, int $mode = …, string $description = …, $default = …)
  • changed: constructor StringInput($input) → constructor StringInput(string $input)
  • changed: method InputDefinition.shortcutToName($shortcut) → method InputDefinition.shortcutToName(string $shortcut): string
  • added: const StringInput.REGEX_UNQUOTED_STRING
  • changed: constructor ConsoleOutput($verbosity = …, $decorated = …, OutputFormatterInterface $formatter = …) → constructor ConsoleOutput(int $verbosity = …, bool $decorated = …, OutputFormatterInterface $formatter = …)
  • changed: constructor Output($verbosity = …, $decorated = …, OutputFormatterInterface $formatter = …) → constructor Output(?int $verbosity = …, bool $decorated = …, OutputFormatterInterface $formatter = …)
  • changed: constructor StreamOutput($stream, $verbosity = …, $decorated = …, OutputFormatterInterface $formatter = …) → constructor StreamOutput($stream, int $verbosity = …, bool $decorated = …, OutputFormatterInterface $formatter = …)
  • added: class ConsoleSectionOutput extends StreamOutput
  • added: class TrimmedBufferOutput extends Output
  • added: constructor ConsoleSectionOutput($stream, array &$sections, int $verbosity, bool $decorated, OutputFormatterInterface $formatter)
  • added: constructor TrimmedBufferOutput(int $maxLength, ?int $verbosity = …, bool $decorated = …, OutputFormatterInterface $formatter = …)
  • added: method ConsoleOutput.section(): ConsoleSectionOutput
  • added: method ConsoleSectionOutput.addContent(string $input)
  • added: method ConsoleSectionOutput.clear(int $lines = …)
  • added: method ConsoleSectionOutput.getContent(): string
  • added: method ConsoleSectionOutput.overwrite($message)
  • added: method TrimmedBufferOutput.fetch()
  • added: protected method ConsoleSectionOutput.doWrite($message, $newline)
  • added: protected method TrimmedBufferOutput.doWrite($message, $newline)
  • changed: constructor ChoiceQuestion($question, array $choices, $default = …) → constructor ChoiceQuestion(string $question, array $choices, $default = …)
  • changed: constructor ConfirmationQuestion($question, $default = …, $trueAnswerRegex = …) → constructor ConfirmationQuestion(string $question, bool $default = …, string $trueAnswerRegex = …)
  • changed: constructor Question($question, $default = …) → constructor Question(string $question, $default = …)
  • added: method Question.getAutocompleterCallback(): ?callable
  • added: method Question.isTrimmable(): bool
  • added: method Question.setAutocompleterCallback(callable $callback = …): self
  • added: method Question.setTrimmable(bool $trimmable): self
  • added: method SymfonyStyle.definitionList(...$list)
  • added: method SymfonyStyle.horizontalTable(array $headers, array $rows)
  • removed: method ApplicationTester.getDisplay($normalize = …)
  • removed: method ApplicationTester.getErrorOutput($normalize = …)
  • removed: method ApplicationTester.getInput()
  • removed: method ApplicationTester.getOutput()
  • removed: method ApplicationTester.getStatusCode()
  • removed: method CommandTester.getDisplay($normalize = …)
  • removed: method CommandTester.getInput()
  • removed: method CommandTester.getOutput()
  • removed: method CommandTester.getStatusCode()
  • removed: method CommandTester.setInputs(array $inputs)
  • added: method TesterTrait.getDisplay($normalize = …)
  • added: method TesterTrait.getErrorOutput($normalize = …)
  • added: method TesterTrait.getInput()
  • added: method TesterTrait.getOutput()
  • added: method TesterTrait.getStatusCode()
  • added: method TesterTrait.setInputs(array $inputs)
  • added: trait TesterTrait