remove deprecated features

This commit is contained in:
Christian Flothmann 2017-10-10 12:58:54 +02:00
parent 592c8fe72a
commit d762dd1dc6
8 changed files with 18 additions and 27 deletions

View File

@ -50,7 +50,7 @@ class Logger extends BaseLogger implements DebugLoggerInterface
*/ */
public function clear() public function clear()
{ {
if (($logger = $this->getDebugLogger()) && method_exists($logger, 'clear')) { if ($logger = $this->getDebugLogger()) {
$logger->clear(); $logger->clear();
} }
} }

View File

@ -5,6 +5,7 @@ CHANGELOG
----- -----
* removed the `ContainerAwareEventDispatcher` class * removed the `ContainerAwareEventDispatcher` class
* added the `reset()` method to the `TraceableEventDispatcherInterface`
3.4.0 3.4.0
----- -----

View File

@ -15,8 +15,6 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/** /**
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @method reset() Resets the trace.
*/ */
interface TraceableEventDispatcherInterface extends EventDispatcherInterface interface TraceableEventDispatcherInterface extends EventDispatcherInterface
{ {
@ -33,4 +31,9 @@ interface TraceableEventDispatcherInterface extends EventDispatcherInterface
* @return array An array of not called listeners * @return array An array of not called listeners
*/ */
public function getNotCalledListeners(); public function getNotCalledListeners();
/**
* Resets the trace.
*/
public function reset();
} }

View File

@ -18,8 +18,6 @@ use Symfony\Component\HttpFoundation\Response;
* DataCollectorInterface. * DataCollectorInterface.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @method reset() Resets this data collector to its initial state.
*/ */
interface DataCollectorInterface interface DataCollectorInterface
{ {
@ -38,4 +36,9 @@ interface DataCollectorInterface
* @return string The collector name * @return string The collector name
*/ */
public function getName(); public function getName();
/**
* Resets this data collector to its initial state.
*/
public function reset();
} }

View File

@ -27,9 +27,6 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
public function __construct(EventDispatcherInterface $dispatcher = null) public function __construct(EventDispatcherInterface $dispatcher = null)
{ {
if ($dispatcher instanceof TraceableEventDispatcherInterface && !method_exists($dispatcher, 'reset')) {
@trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since version 3.4 and will be unsupported in 4.0 for class "%s".', TraceableEventDispatcherInterface::class, \get_class($dispatcher)), E_USER_DEPRECATED);
}
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
} }
@ -49,10 +46,6 @@ class EventDataCollector extends DataCollector implements LateDataCollectorInter
$this->data = array(); $this->data = array();
if ($this->dispatcher instanceof TraceableEventDispatcherInterface) { if ($this->dispatcher instanceof TraceableEventDispatcherInterface) {
if (!method_exists($this->dispatcher, 'reset')) {
return; // @deprecated
}
$this->dispatcher->reset(); $this->dispatcher->reset();
} }
} }

View File

@ -29,10 +29,6 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
public function __construct($logger = null, $containerPathPrefix = null) public function __construct($logger = null, $containerPathPrefix = null)
{ {
if (null !== $logger && $logger instanceof DebugLoggerInterface) { if (null !== $logger && $logger instanceof DebugLoggerInterface) {
if (!method_exists($logger, 'clear')) {
@trigger_error(sprintf('Implementing "%s" without the "clear()" method is deprecated since version 3.4 and will be unsupported in 4.0 for class "%s".', DebugLoggerInterface::class, \get_class($logger)), E_USER_DEPRECATED);
}
$this->logger = $logger; $this->logger = $logger;
} }
@ -52,7 +48,7 @@ class LoggerDataCollector extends DataCollector implements LateDataCollectorInte
*/ */
public function reset() public function reset()
{ {
if ($this->logger && method_exists($this->logger, 'clear')) { if ($this->logger instanceof DebugLoggerInterface) {
$this->logger->clear(); $this->logger->clear();
} }
$this->data = array(); $this->data = array();

View File

@ -15,8 +15,6 @@ namespace Symfony\Component\HttpKernel\Log;
* DebugLoggerInterface. * DebugLoggerInterface.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @method clear() Removes all log records.
*/ */
interface DebugLoggerInterface interface DebugLoggerInterface
{ {
@ -37,4 +35,9 @@ interface DebugLoggerInterface
* @return int The number of errors * @return int The number of errors
*/ */
public function countErrors(); public function countErrors();
/**
* Removes all log records.
*/
public function clear();
} }

View File

@ -198,10 +198,6 @@ class Profiler
public function reset() public function reset()
{ {
foreach ($this->collectors as $collector) { foreach ($this->collectors as $collector) {
if (!method_exists($collector, 'reset')) {
continue;
}
$collector->reset(); $collector->reset();
} }
$this->enabled = $this->initiallyEnabled; $this->enabled = $this->initiallyEnabled;
@ -237,10 +233,6 @@ class Profiler
*/ */
public function add(DataCollectorInterface $collector) public function add(DataCollectorInterface $collector)
{ {
if (!method_exists($collector, 'reset')) {
@trigger_error(sprintf('Implementing "%s" without the "reset()" method is deprecated since version 3.4 and will be unsupported in 4.0 for class "%s".', DataCollectorInterface::class, \get_class($collector)), E_USER_DEPRECATED);
}
$this->collectors[$collector->getName()] = $collector; $this->collectors[$collector->getName()] = $collector;
} }