|
42 | 42 | use Symfony\Component\Console\Output\OutputInterface; |
43 | 43 | use Symfony\Component\Console\Style\SymfonyStyle; |
44 | 44 | use Symfony\Component\ErrorHandler\ErrorHandler; |
45 | | -use Symfony\Component\ErrorHandler\Exception\ErrorException; |
46 | 45 | use Symfony\Contracts\EventDispatcher\EventDispatcherInterface; |
47 | 46 | use Symfony\Contracts\Service\ResetInterface; |
48 | 47 |
|
@@ -758,79 +757,19 @@ public static function getAbbreviations(array $names) |
758 | 757 | return $abbrevs; |
759 | 758 | } |
760 | 759 |
|
761 | | - /** |
762 | | - * Renders a caught exception. |
763 | | - * |
764 | | - * @deprecated since Symfony 4.4, use "renderThrowable()" instead |
765 | | - */ |
766 | | - public function renderException(\Exception $e, OutputInterface $output) |
767 | | - { |
768 | | - @trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); |
769 | | - |
770 | | - $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
771 | | - |
772 | | - $this->doRenderException($e, $output); |
773 | | - |
774 | | - $this->finishRenderThrowableOrException($output); |
775 | | - } |
776 | | - |
777 | 760 | public function renderThrowable(\Throwable $e, OutputInterface $output): void |
778 | 761 | { |
779 | | - if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'renderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'renderException'))->getDeclaringClass()->getName()) { |
780 | | - @trigger_error(sprintf('The "%s::renderException()" method is deprecated since Symfony 4.4, use "renderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); |
781 | | - |
782 | | - if (!$e instanceof \Exception) { |
783 | | - $e = class_exists(ErrorException::class) ? new ErrorException($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); |
784 | | - } |
785 | | - |
786 | | - $this->renderException($e, $output); |
787 | | - |
788 | | - return; |
789 | | - } |
790 | | - |
791 | 762 | $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
792 | 763 |
|
793 | 764 | $this->doRenderThrowable($e, $output); |
794 | 765 |
|
795 | | - $this->finishRenderThrowableOrException($output); |
796 | | - } |
797 | | - |
798 | | - private function finishRenderThrowableOrException(OutputInterface $output): void |
799 | | - { |
800 | 766 | if (null !== $this->runningCommand) { |
801 | 767 | $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET); |
802 | 768 | $output->writeln('', OutputInterface::VERBOSITY_QUIET); |
803 | 769 | } |
804 | 770 | } |
805 | 771 |
|
806 | | - /** |
807 | | - * @deprecated since Symfony 4.4, use "doRenderThrowable()" instead |
808 | | - */ |
809 | | - protected function doRenderException(\Exception $e, OutputInterface $output) |
810 | | - { |
811 | | - @trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); |
812 | | - |
813 | | - $this->doActuallyRenderThrowable($e, $output); |
814 | | - } |
815 | | - |
816 | 772 | protected function doRenderThrowable(\Throwable $e, OutputInterface $output): void |
817 | | - { |
818 | | - if (__CLASS__ !== \get_class($this) && __CLASS__ === (new \ReflectionMethod($this, 'doRenderThrowable'))->getDeclaringClass()->getName() && __CLASS__ !== (new \ReflectionMethod($this, 'doRenderException'))->getDeclaringClass()->getName()) { |
819 | | - @trigger_error(sprintf('The "%s::doRenderException()" method is deprecated since Symfony 4.4, use "doRenderThrowable()" instead.', __CLASS__), E_USER_DEPRECATED); |
820 | | - |
821 | | - if (!$e instanceof \Exception) { |
822 | | - $e = class_exists(ErrorException::class) ? new ErrorException($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine()); |
823 | | - } |
824 | | - |
825 | | - $this->doRenderException($e, $output); |
826 | | - |
827 | | - return; |
828 | | - } |
829 | | - |
830 | | - $this->doActuallyRenderThrowable($e, $output); |
831 | | - } |
832 | | - |
833 | | - private function doActuallyRenderThrowable(\Throwable $e, OutputInterface $output): void |
834 | 773 | { |
835 | 774 | do { |
836 | 775 | $message = trim($e->getMessage()); |
|
0 commit comments