Skip to content

Commit 9ed1dd1

Browse files
committed
feature #32471 Add a new ErrorHandler component (mirror of the Debug component) (yceruto)
This PR was squashed before being merged into the 4.4 branch (closes #32471). Discussion ---------- Add a new ErrorHandler component (mirror of the Debug component) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - On top of #32470 Commits ------- b1b6e80 Add a new ErrorHandler component (mirror of the Debug component)
2 parents ba988ac + b1b6e80 commit 9ed1dd1

File tree

115 files changed

+4733
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+4733
-26
lines changed

UPGRADE-4.4.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ Cache
66

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

9+
Debug
10+
-----
11+
12+
* Deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component
13+
* Deprecated the whole component in favor of `ErrorHandler` component
14+
915
DependencyInjection
1016
-------------------
1117

UPGRADE-5.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Console
5151
$processHelper->run($output, Process::fromShellCommandline('ls -l'));
5252
```
5353

54+
Debug
55+
-----
56+
57+
* Removed the component
58+
5459
DependencyInjection
5560
-------------------
5661

src/Symfony/Bridge/PhpUnit/Legacy/SymfonyTestsListenerTrait.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
use PHPUnit\Util\Blacklist;
1919
use Symfony\Bridge\PhpUnit\ClockMock;
2020
use Symfony\Bridge\PhpUnit\DnsMock;
21-
use Symfony\Component\Debug\DebugClassLoader;
21+
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
22+
use Symfony\Component\ErrorHandler\DebugClassLoader;
2223

2324
/**
2425
* PHP 5.3 compatible trait-like shared implementation.
@@ -53,7 +54,7 @@ public function __construct(array $mockedNamespaces = array())
5354
Blacklist::$blacklistedClassNames['\Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerTrait'] = 2;
5455
}
5556

56-
$enableDebugClassLoader = class_exists('Symfony\Component\Debug\DebugClassLoader');
57+
$enableDebugClassLoader = class_exists(DebugClassLoader::class) || class_exists(LegacyDebugClassLoader::class);
5758

5859
foreach ($mockedNamespaces as $type => $namespaces) {
5960
if (!\is_array($namespaces)) {
@@ -74,7 +75,11 @@ public function __construct(array $mockedNamespaces = array())
7475
}
7576
}
7677
if ($enableDebugClassLoader) {
77-
DebugClassLoader::enable();
78+
if (class_exists(DebugClassLoader::class)) {
79+
DebugClassLoader::enable();
80+
} else {
81+
LegacyDebugClassLoader::enable();
82+
}
7883
}
7984
if (self::$globallyEnabled) {
8085
$this->state = -2;

src/Symfony/Bridge/PhpUnit/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"php": ">=5.5.9"
2222
},
2323
"suggest": {
24-
"symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
24+
"symfony/error-handler": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
2525
},
2626
"conflict": {
2727
"phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"

src/Symfony/Bundle/FrameworkBundle/Console/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
use Symfony\Component\Console\Output\ConsoleOutputInterface;
2020
use Symfony\Component\Console\Output\OutputInterface;
2121
use Symfony\Component\Console\Style\SymfonyStyle;
22-
use Symfony\Component\Debug\Exception\FatalThrowableError;
2322
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
23+
use Symfony\Component\ErrorHandler\Exception\FatalThrowableError;
2424
use Symfony\Component\HttpKernel\Bundle\Bundle;
2525
use Symfony\Component\HttpKernel\Kernel;
2626
use Symfony\Component\HttpKernel\KernelInterface;

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
use Symfony\Component\Cache\DependencyInjection\CachePoolPrunerPass;
3030
use Symfony\Component\Config\Resource\ClassExistenceResource;
3131
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
32-
use Symfony\Component\Debug\ErrorHandler;
3332
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
3433
use Symfony\Component\DependencyInjection\Compiler\RegisterReverseContainerPass;
3534
use Symfony\Component\DependencyInjection\ContainerBuilder;
35+
use Symfony\Component\ErrorHandler\ErrorHandler;
3636
use Symfony\Component\ErrorRenderer\DependencyInjection\ErrorRendererPass;
3737
use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass;
3838
use Symfony\Component\Form\DependencyInjection\FormPass;

src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
"symfony/asset": "<3.4",
7171
"symfony/browser-kit": "<4.3",
7272
"symfony/console": "<4.3",
73-
"symfony/debug": "<4.4",
7473
"symfony/dotenv": "<4.2",
7574
"symfony/dom-crawler": "<4.3",
7675
"symfony/form": "<4.3",

src/Symfony/Component/Debug/BufferingLogger.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313

1414
use Psr\Log\AbstractLogger;
1515

16+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', BufferingLogger::class, \Symfony\Component\ErrorHandler\BufferingLogger::class), E_USER_DEPRECATED);
17+
1618
/**
1719
* A buffering logger that stacks logs for later.
1820
*
1921
* @author Nicolas Grekas <p@tchwork.com>
22+
*
23+
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\BufferingLogger instead.
2024
*/
2125
class BufferingLogger extends AbstractLogger
2226
{

src/Symfony/Component/Debug/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
-----
66

77
* deprecated `FlattenException`, use the `FlattenException` of the `ErrorRenderer` component
8+
* deprecated the whole component in favor of the `ErrorHandler` component
89

910
4.3.0
1011
-----

src/Symfony/Component/Debug/Debug.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111

1212
namespace Symfony\Component\Debug;
1313

14+
@trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', Debug::class, \Symfony\Component\ErrorHandler\Debug::class), E_USER_DEPRECATED);
15+
1416
/**
1517
* Registers all the debug tools.
1618
*
1719
* @author Fabien Potencier <fabien@symfony.com>
20+
*
21+
* @deprecated since Symfony 4.4, use Symfony\Component\ErrorHandler\Debug instead.
1822
*/
1923
class Debug
2024
{

0 commit comments

Comments
 (0)