Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Deprecating the Debug component
  • Loading branch information
yceruto committed Jul 10, 2019
1 parent 2fd6dba commit 009cd5a
Show file tree
Hide file tree
Showing 29 changed files with 98 additions and 0 deletions.
6 changes: 6 additions & 0 deletions UPGRADE-4.4.md
Expand Up @@ -6,6 +6,12 @@ Cache

* Added argument `$prefix` to `AdapterInterface::clear()`

Debug
-----

* Deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component
* Deprecated the whole component in favor of `ErrorHandler` component

DependencyInjection
-------------------

Expand Down
5 changes: 5 additions & 0 deletions UPGRADE-5.0.md
Expand Up @@ -51,6 +51,11 @@ Console
$processHelper->run($output, Process::fromShellCommandline('ls -l'));
```

Debug
-----

* Removed the component

DependencyInjection
-------------------

Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/BufferingLogger.php
Expand Up @@ -13,10 +13,14 @@

use Psr\Log\AbstractLogger;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\BufferingLogger" instead.', BufferingLogger::class), E_USER_DEPRECATED);

/**
* A buffering logger that stacks logs for later.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\BufferingLogger instead.
*/
class BufferingLogger extends AbstractLogger
{
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Debug/CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ CHANGELOG
-----

* deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component
* deprecated the whole component in favor of the `ErrorHandler` component

4.3.0
-----
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/Debug.php
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Debug" instead.', Debug::class), E_USER_DEPRECATED);

/**
* Registers all the debug tools.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Debug instead.
*/
class Debug
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/DebugClassLoader.php
Expand Up @@ -13,6 +13,8 @@

use PHPUnit\Framework\MockObject\Matcher\StatelessInvocation;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\DebugClassLoader" instead.', DebugClassLoader::class), E_USER_DEPRECATED);

/**
* Autoloader checking if the class is really defined in the file found.
*
Expand All @@ -24,6 +26,8 @@
* @author Christophe Coevoet <stof@notk.org>
* @author Nicolas Grekas <p@tchwork.com>
* @author Guilhem Niot <guilhem.niot@gmail.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\DebugClassLoader instead.
*/
class DebugClassLoader
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/ErrorHandler.php
Expand Up @@ -23,6 +23,8 @@
use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\ErrorHandler" instead.', ErrorHandler::class), E_USER_DEPRECATED);

/**
* A generic ErrorHandler for the PHP engine.
*
Expand All @@ -47,6 +49,8 @@
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @final since Symfony 4.3
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\ErrorHandler instead.
*/
class ErrorHandler
{
Expand Down
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\ClassNotFoundException" instead.', ClassNotFoundException::class), E_USER_DEPRECATED);

/**
* Class (or Trait or Interface) Not Found Exception.
*
* @author Konstanton Myakshin <koc-dp@yandex.ru>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\ClassNotFoundException instead.
*/
class ClassNotFoundException extends FatalErrorException
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/Exception/FatalErrorException.php
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\FatalErrorException" instead.', FatalErrorException::class), E_USER_DEPRECATED);

/**
* Fatal Error Exception.
*
* @author Konstanton Myakshin <koc-dp@yandex.ru>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\FatalErrorException instead.
*/
class FatalErrorException extends \ErrorException
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/Exception/FatalThrowableError.php
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\FatalThrowableError" instead.', FatalThrowableError::class), E_USER_DEPRECATED);

/**
* Fatal Throwable Error.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\FatalThrowableError instead.
*/
class FatalThrowableError extends FatalErrorException
{
Expand Down
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\OutOfMemoryException" instead.', OutOfMemoryException::class), E_USER_DEPRECATED);

/**
* Out of memory exception.
*
* @author Nicolas Grekas <p@tchwork.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\OutOfMemoryException instead.
*/
class OutOfMemoryException extends FatalErrorException
{
Expand Down
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\SilencedErrorContext" instead.', SilencedErrorContext::class), E_USER_DEPRECATED);

/**
* Data Object that represents a Silenced Error.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\SilencedErrorContext instead.
*/
class SilencedErrorContext implements \JsonSerializable
{
Expand Down
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException" instead.', UndefinedFunctionException::class), E_USER_DEPRECATED);

/**
* Undefined Function Exception.
*
* @author Konstanton Myakshin <koc-dp@yandex.ru>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\UndefinedFunctionException instead.
*/
class UndefinedFunctionException extends FatalErrorException
{
Expand Down
Expand Up @@ -11,10 +11,14 @@

namespace Symfony\Component\Debug\Exception;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\Exception\UndefinedMethodException" instead.', UndefinedMethodException::class), E_USER_DEPRECATED);

/**
* Undefined Method Exception.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Exception\UndefinedMethodException instead.
*/
class UndefinedMethodException extends FatalErrorException
{
Expand Down
4 changes: 4 additions & 0 deletions src/Symfony/Component/Debug/ExceptionHandler.php
Expand Up @@ -15,6 +15,8 @@
use Symfony\Component\Debug\Exception\OutOfMemoryException;
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\ExceptionHandler" instead.', ExceptionHandler::class), E_USER_DEPRECATED);

/**
* ExceptionHandler converts an exception to a Response object.
*
Expand All @@ -28,6 +30,8 @@
* @author Nicolas Grekas <p@tchwork.com>
*
* @final since Symfony 4.3
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\ExceptionHandler instead.
*/
class ExceptionHandler
{
Expand Down
Expand Up @@ -17,10 +17,14 @@
use Symfony\Component\Debug\Exception\ClassNotFoundException;
use Symfony\Component\Debug\Exception\FatalErrorException;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\FatalErrorHandler\ClassNotFoundFatalErrorHandler" instead.', ClassNotFoundFatalErrorHandler::class), E_USER_DEPRECATED);

/**
* ErrorHandler for classes that do not exist.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\FatalErrorHandler\ClassNotFoundFatalErrorHandler instead.
*/
class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
{
Expand Down
Expand Up @@ -13,10 +13,14 @@

use Symfony\Component\Debug\Exception\FatalErrorException;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\FatalErrorHandler\FatalErrorHandlerInterface" instead.', FatalErrorHandlerInterface::class), E_USER_DEPRECATED);

/**
* Attempts to convert fatal errors to exceptions.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\FatalErrorHandler\FatalErrorHandlerInterface instead.
*/
interface FatalErrorHandlerInterface
{
Expand Down
Expand Up @@ -14,10 +14,14 @@
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\UndefinedFunctionException;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\FatalErrorHandler\UndefinedFunctionFatalErrorHandler" instead.', UndefinedFunctionFatalErrorHandler::class), E_USER_DEPRECATED);

/**
* ErrorHandler for undefined functions.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\FatalErrorHandler\UndefinedFunctionFatalErrorHandler instead.
*/
class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
{
Expand Down
Expand Up @@ -14,10 +14,14 @@
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\Exception\UndefinedMethodException;

@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "Symfony\Component\ErrorHandler\FatalErrorHandler\UndefinedMethodFatalErrorHandler" instead.', UndefinedMethodFatalErrorHandler::class), E_USER_DEPRECATED);

/**
* ErrorHandler for undefined methods.
*
* @author Grégoire Pineau <lyrixx@lyrixx.info>
*
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\FatalErrorHandler\UndefinedMethodFatalErrorHandler instead.
*/
class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
Expand Up @@ -14,6 +14,9 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\Debug\DebugClassLoader;

/**
* @group legacy
*/
class DebugClassLoaderTest extends TestCase
{
/**
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
Expand Up @@ -25,6 +25,8 @@
*
* @author Robert Schönthal <seroscho@googlemail.com>
* @author Nicolas Grekas <p@tchwork.com>
*
* @group legacy
*/
class ErrorHandlerTest extends TestCase
{
Expand Down
3 changes: 3 additions & 0 deletions src/Symfony/Component/Debug/Tests/ExceptionHandlerTest.php
Expand Up @@ -19,6 +19,9 @@

require_once __DIR__.'/HeaderMock.php';

/**
* @group legacy
*/
class ExceptionHandlerTest extends TestCase
{
protected function setUp()
Expand Down
Expand Up @@ -17,6 +17,9 @@
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;

/**
* @group legacy
*/
class ClassNotFoundFatalErrorHandlerTest extends TestCase
{
public static function setUpBeforeClass()
Expand Down
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;

/**
* @group legacy
*/
class UndefinedFunctionFatalErrorHandlerTest extends TestCase
{
/**
Expand Down
Expand Up @@ -15,6 +15,9 @@
use Symfony\Component\Debug\Exception\FatalErrorException;
use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;

/**
* @group legacy
*/
class UndefinedMethodFatalErrorHandlerTest extends TestCase
{
/**
Expand Down
Expand Up @@ -23,5 +23,6 @@ class_exists(ExtendedFinalMethod::class);

?>
--EXPECTF--
%A
The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".
The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".
Expand Up @@ -26,6 +26,7 @@ if (true) {

?>
--EXPECTF--
%A
object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) {
["message":protected]=>
string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug".
Expand Down
Expand Up @@ -35,6 +35,7 @@ array(1) {
[0]=>
string(37) "Error and exception handlers do match"
}
%A
object(Symfony\Component\Debug\Exception\FatalErrorException)#%d (%d) {
["message":protected]=>
string(179) "Error: Class Symfony\Component\Debug\Broken contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (JsonSerializable::jsonSerialize)"
Expand Down
Expand Up @@ -40,6 +40,8 @@ public static function setUpBeforeClass()

/**
* @dataProvider provideClassNotFoundData
*
* @group legacy Remove only the annotation in 5.0 when the Debug component is gone.
*/
public function testHandleClassNotFound($error, $translatedMessage, $autoloader = null)
{
Expand Down

0 comments on commit 009cd5a

Please sign in to comment.