Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Log deprecation notice of GenericEventWrapper just once
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and backportbot[bot] committed Feb 5, 2021
commit 61278d2461648d258b3fadfc78fa612c887d60c0
8 changes: 8 additions & 0 deletions lib/private/EventDispatcher/GenericEventWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class GenericEventWrapper extends GenericEvent {
/** @var string */
private $eventName;

/** @var bool */
private $deprecationNoticeLogged = false;

public function __construct(ILogger $logger, string $eventName, ?GenericEvent $event) {
parent::__construct($eventName);
$this->logger = $logger;
Expand All @@ -49,11 +52,16 @@ public function __construct(ILogger $logger, string $eventName, ?GenericEvent $e
}

private function log() {
if ($this->deprecationNoticeLogged) {
return;
}

$class = ($this->event !== null && is_object($this->event)) ? get_class($this->event) : 'null';
$this->logger->info(
'Deprecated event type for {name}: {class} is used',
[ 'name' => $this->eventName, 'class' => $class]
);
$this->deprecationNoticeLogged = true;
}

public function isPropagationStopped(): bool {
Expand Down