Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ebb916b

Browse filesBrowse files
committed
[FrameworkBundle][5.4] Remove fileLinkFormat property from DebugHandlersListener
1 parent c1c973c commit ebb916b
Copy full SHA for ebb916b

File tree

4 files changed

+29
-14
lines changed
Filter options

4 files changed

+29
-14
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Resources/config/debug_prod.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
null, // Log levels map for enabled error levels
2626
param('debug.error_handler.throw_at'),
2727
param('kernel.debug'),
28-
service('debug.file_link_formatter'),
2928
param('kernel.debug'),
3029
service('monolog.logger.deprecation')->nullOnInvalid(),
3130
])

‎src/Symfony/Component/HttpKernel/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CHANGELOG
55
---
66

77
* Deprecate `AbstractTestSessionListener::getSession` inject a session in the request instead
8+
* Deprecate the `fileLinkFormat` parameter of `DebugHandlersListener`
89

910
5.3
1011
---

‎src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Console\Output\ConsoleOutputInterface;
1818
use Symfony\Component\ErrorHandler\ErrorHandler;
1919
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
20-
use Symfony\Component\HttpKernel\Debug\FileLinkFormatter;
2120
use Symfony\Component\HttpKernel\Event\KernelEvent;
2221
use Symfony\Component\HttpKernel\KernelEvents;
2322

@@ -39,21 +38,25 @@ class DebugHandlersListener implements EventSubscriberInterface
3938
private $levels;
4039
private $throwAt;
4140
private $scream;
42-
private $fileLinkFormat;
4341
private $scope;
4442
private $firstCall = true;
4543
private $hasTerminatedWithException;
4644

4745
/**
48-
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
49-
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
50-
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
51-
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
52-
* @param string|FileLinkFormatter|null $fileLinkFormat The format for links to source files
53-
* @param bool $scope Enables/disables scoping mode
46+
* @param callable|null $exceptionHandler A handler that must support \Throwable instances that will be called on Exception
47+
* @param array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants
48+
* @param int|null $throwAt Thrown errors in a bit field of E_* constants, or null to keep the current value
49+
* @param bool $scream Enables/disables screaming mode, where even silenced errors are logged
50+
* @param bool $scope Enables/disables scoping mode
5451
*/
55-
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $fileLinkFormat = null, bool $scope = true, LoggerInterface $deprecationLogger = null)
52+
public function __construct(callable $exceptionHandler = null, LoggerInterface $logger = null, $levels = \E_ALL, ?int $throwAt = \E_ALL, bool $scream = true, $scope = true, $deprecationLogger = null, $fileLinkFormat = null)
5653
{
54+
if (!\is_bool($scope)) {
55+
trigger_deprecation('symfony/http-kernel', '5.4', 'Passing a $fileLinkFormat is deprecated.');
56+
$scope = $deprecationLogger;
57+
$deprecationLogger = $fileLinkFormat;
58+
}
59+
5760
$handler = set_exception_handler('var_dump');
5861
$this->earlyHandler = \is_array($handler) ? $handler[0] : null;
5962
restore_exception_handler();
@@ -63,7 +66,6 @@ public function __construct(callable $exceptionHandler = null, LoggerInterface $
6366
$this->levels = $levels ?? \E_ALL;
6467
$this->throwAt = \is_int($throwAt) ? $throwAt : (null === $throwAt ? null : ($throwAt ? \E_ALL : null));
6568
$this->scream = $scream;
66-
$this->fileLinkFormat = $fileLinkFormat;
6769
$this->scope = $scope;
6870
$this->deprecationLogger = $deprecationLogger;
6971
}

‎src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/EventListener/DebugHandlersListenerTest.php
+16-3Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
namespace Symfony\Component\HttpKernel\Tests\EventListener;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Psr\Log\LoggerInterface;
1615
use Psr\Log\LogLevel;
16+
use Psr\Log\LoggerInterface;
17+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1718
use Symfony\Component\Console\Application;
1819
use Symfony\Component\Console\Command\Command;
1920
use Symfony\Component\Console\ConsoleEvents;
@@ -24,8 +25,8 @@
2425
use Symfony\Component\ErrorHandler\ErrorHandler;
2526
use Symfony\Component\EventDispatcher\EventDispatcher;
2627
use Symfony\Component\HttpFoundation\Request;
27-
use Symfony\Component\HttpKernel\Event\KernelEvent;
2828
use Symfony\Component\HttpKernel\EventListener\DebugHandlersListener;
29+
use Symfony\Component\HttpKernel\Event\KernelEvent;
2930
use Symfony\Component\HttpKernel\HttpKernelInterface;
3031
use Symfony\Component\HttpKernel\KernelEvents;
3132

@@ -34,6 +35,8 @@
3435
*/
3536
class DebugHandlersListenerTest extends TestCase
3637
{
38+
use ExpectDeprecationTrait;
39+
3740
public function testConfigure()
3841
{
3942
$logger = $this->createMock(LoggerInterface::class);
@@ -219,7 +222,7 @@ public function testLevelsAssignedToLoggers(bool $hasLogger, bool $hasDeprecatio
219222
->method('setDefaultLogger')
220223
->withConsecutive(...$expectedCalls);
221224

222-
$sut = new DebugHandlersListener(null, $logger, $levels, null, true, null, true, $deprecationLogger);
225+
$sut = new DebugHandlersListener(null, $logger, $levels, null, true, true, $deprecationLogger);
223226
$prevHander = set_exception_handler([$handler, 'handleError']);
224227

225228
try {
@@ -236,4 +239,14 @@ public function testLevelsAssignedToLoggers(bool $hasLogger, bool $hasDeprecatio
236239
throw $e;
237240
}
238241
}
242+
243+
/**
244+
* @group legacy
245+
*/
246+
public function testLegacyConstructor()
247+
{
248+
$this->expectDeprecation('Since symfony/http-kernel 5.4: Passing a $fileLinkFormat is deprecated.');
249+
250+
new DebugHandlersListener(null, null, \E_ALL, \E_ALL, true, 'filelinkformat', true, $this->createMock(LoggerInterface::class));
251+
}
239252
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.