Skip to content

Commit 735ff17

Browse files
author
Hugo Hamon
committed
Fixes deprecation notices.
1 parent 7e78434 commit 735ff17

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

EventListener/ProfilerListener.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
2323

2424
/**
25-
* ProfilerListener collects data for the current request by listening to the onKernelResponse event.
25+
* ProfilerListener collects data for the current request by listening to the kernel events.
2626
*
2727
* @author Fabien Potencier <[email protected]>
2828
*/
@@ -49,6 +49,13 @@ class ProfilerListener implements EventSubscriberInterface
4949
*/
5050
public function __construct(Profiler $profiler, RequestMatcherInterface $matcher = null, $onlyException = false, $onlyMasterRequests = false, RequestStack $requestStack = null)
5151
{
52+
if (null === $requestStack) {
53+
// Prevent the deprecation notice to be triggered all the time.
54+
// The onKernelRequest() method fires some logic only when the
55+
// RequestStack instance is not provided as a dependency.
56+
trigger_error('The '.__CLASS__.'::onKernelRequest method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
57+
}
58+
5259
$this->profiler = $profiler;
5360
$this->matcher = $matcher;
5461
$this->onlyException = (bool) $onlyException;
@@ -77,8 +84,6 @@ public function onKernelException(GetResponseForExceptionEvent $event)
7784
*/
7885
public function onKernelRequest(GetResponseEvent $event)
7986
{
80-
trigger_error('The '.__METHOD__.' method is deprecated since version 2.4 and will be removed in 3.0.', E_USER_DEPRECATED);
81-
8287
if (null === $this->requestStack) {
8388
$this->requests[] = $event->getRequest();
8489
}

Log/NullLogger.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\HttpKernel\Log;
1313

14+
trigger_error('The '.__NAMESPACE__.'\NullLogger class is deprecated since version 2.2 and will be removed in 3.0. Use the Psr\Log\NullLogger class instead from the psr/log Composer package.');
15+
1416
use Psr\Log\NullLogger as PsrNullLogger;
1517

1618
/**
@@ -24,8 +26,6 @@ class NullLogger extends PsrNullLogger implements LoggerInterface
2426
{
2527
/**
2628
* @api
27-
*
28-
* @deprecated since version 2.2, to be removed in 3.0. Use emergency() which is PSR-3 compatible.
2929
*/
3030
public function emerg($message, array $context = array())
3131
{
@@ -34,8 +34,6 @@ public function emerg($message, array $context = array())
3434

3535
/**
3636
* @api
37-
*
38-
* @deprecated since version 2.2, to be removed in 3.0. Use critical() which is PSR-3 compatible.
3937
*/
4038
public function crit($message, array $context = array())
4139
{
@@ -44,8 +42,6 @@ public function crit($message, array $context = array())
4442

4543
/**
4644
* @api
47-
*
48-
* @deprecated since version 2.2, to be removed in 3.0. Use error() which is PSR-3 compatible.
4945
*/
5046
public function err($message, array $context = array())
5147
{
@@ -54,8 +50,6 @@ public function err($message, array $context = array())
5450

5551
/**
5652
* @api
57-
*
58-
* @deprecated since version 2.2, to be removed in 3.0. Use warning() which is PSR-3 compatible.
5953
*/
6054
public function warn($message, array $context = array())
6155
{

0 commit comments

Comments
 (0)