From b785058eaa610c4ee5feaa81e0044865842b94d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20K=C3=B6rner?= Date: Fri, 3 Jan 2025 12:24:55 +0100 Subject: [PATCH] fix exception, remove outdated code --- src/Command/EntityFinderCommand.php | 17 ++++------------- src/Event/EntityFinderFindEvent.php | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/Command/EntityFinderCommand.php b/src/Command/EntityFinderCommand.php index 0c41eab0..825fd897 100644 --- a/src/Command/EntityFinderCommand.php +++ b/src/Command/EntityFinderCommand.php @@ -271,19 +271,10 @@ private function createText(string $table, $id): string private function runExtendEntityFinderEvent(string $table, $id, array $parents, bool $onlyText = false): ExtendEntityFinderEvent { - /* @var ExtendEntityFinderEvent $event */ - if (is_subclass_of($this->eventDispatcher, 'Symfony\Contracts\EventDispatcher\EventDispatcherInterface')) { - $event = $this->eventDispatcher->dispatch( - new ExtendEntityFinderEvent($table, $id, $parents, [], $this->entityFinderHelper, $onlyText), - ExtendEntityFinderEvent::class - ); - } else { - /** @noinspection PhpParamsInspection */ - $event = $this->eventDispatcher->dispatch( - ExtendEntityFinderEvent::class, - new ExtendEntityFinderEvent($table, $id, $parents, [], $this->entityFinderHelper, $onlyText) - ); - } + $event = $this->eventDispatcher->dispatch( + new ExtendEntityFinderEvent($table, $id, $parents, [], $this->entityFinderHelper, $onlyText), + ExtendEntityFinderEvent::class + ); return $event; } diff --git a/src/Event/EntityFinderFindEvent.php b/src/Event/EntityFinderFindEvent.php index b8fb5427..33ffcc7f 100644 --- a/src/Event/EntityFinderFindEvent.php +++ b/src/Event/EntityFinderFindEvent.php @@ -9,7 +9,7 @@ class EntityFinderFindEvent extends Event { private string $table; private int $id; - private ?Element $element; + private ?Element $element = null; public function __construct(string $table, int $id) {