[Debug] Drop compatibility layers

This commit is contained in:
Robin Chalas 2019-08-08 00:03:58 +02:00 committed by Robin Chalas
parent 1126fa6a58
commit 2326b80d1a
3 changed files with 4 additions and 23 deletions

View File

@ -12,6 +12,7 @@ namespace ProxyManager\Generator\Util;
use Composer\Autoload\ClassLoader; use Composer\Autoload\ClassLoader;
use ProxyManager\Version; use ProxyManager\Version;
use Symfony\Component\ErrorHandler\DebugClassLoader;
if (class_exists(Version::class) && version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.5', '<')) { if (class_exists(Version::class) && version_compare(\defined(Version::class.'::VERSION') ? Version::VERSION : Version::getVersion(), '2.5', '<')) {
/** /**
@ -51,10 +52,7 @@ if (class_exists(Version::class) && version_compare(\defined(Version::class.'::V
if ($functionLoader instanceof ClassLoader) { if ($functionLoader instanceof ClassLoader) {
return $functionLoader; return $functionLoader;
} }
if ($functionLoader instanceof \Symfony\Component\Debug\DebugClassLoader) { if ($functionLoader instanceof DebugClassLoader) {
return $getComposerClassLoader($functionLoader->getClassLoader());
}
if ($functionLoader instanceof \Symfony\Component\ErrorHandler\DebugClassLoader) {
return $getComposerClassLoader($functionLoader->getClassLoader()); return $getComposerClassLoader($functionLoader->getClassLoader());
} }
}; };

View File

@ -41,8 +41,6 @@ use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\Debug\ErrorHandler as LegacyErrorHandler;
use Symfony\Component\Debug\Exception\FatalThrowableError as LegacyFatalThrowableError;
use Symfony\Component\ErrorHandler\ErrorHandler; use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\ErrorHandler\Exception\FatalThrowableError; use Symfony\Component\ErrorHandler\Exception\FatalThrowableError;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
@ -124,7 +122,7 @@ class Application implements ResetInterface
$renderException = function ($e) use ($output) { $renderException = function ($e) use ($output) {
if (!$e instanceof \Exception) { if (!$e instanceof \Exception) {
$e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : (class_exists(LegacyFatalThrowableError::class) ? new LegacyFatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine())); $e = class_exists(FatalThrowableError::class) ? new FatalThrowableError($e) : new \ErrorException($e->getMessage(), $e->getCode(), E_ERROR, $e->getFile(), $e->getLine());
} }
if ($output instanceof ConsoleOutputInterface) { if ($output instanceof ConsoleOutputInterface) {
$this->renderException($e, $output->getErrorOutput()); $this->renderException($e, $output->getErrorOutput());
@ -134,7 +132,7 @@ class Application implements ResetInterface
}; };
if ($phpHandler = set_exception_handler($renderException)) { if ($phpHandler = set_exception_handler($renderException)) {
restore_exception_handler(); restore_exception_handler();
if (!\is_array($phpHandler) || (!$phpHandler[0] instanceof ErrorHandler && !$phpHandler[0] instanceof LegacyErrorHandler)) { if (!\is_array($phpHandler) || !$phpHandler[0] instanceof ErrorHandle)) {
$errorHandler = true; $errorHandler = true;
} elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) { } elseif ($errorHandler = $phpHandler[0]->setExceptionHandler($renderException)) {
$phpHandler[0]->setExceptionHandler($errorHandler); $phpHandler[0]->setExceptionHandler($errorHandler);

View File

@ -364,18 +364,3 @@ class FlattenException
return rtrim($message); return rtrim($message);
} }
} }
namespace Symfony\Component\Debug\Exception;
if (!class_exists(FlattenException::class, false)) {
class_alias(\Symfony\Component\ErrorRenderer\Exception\FlattenException::class, FlattenException::class);
}
if (false) {
/**
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorRenderer\Exception\FlattenException instead.
*/
class FlattenException extends \Symfony\Component\ErrorRenderer\Exception\FlattenException
{
}
}