diff --git a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
index 77907fab2816a8140487ccc95ccd917761a78d11..8d4a3f2378743adfb216ee59cb60b619b8b195d8 100644
--- a/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
+++ b/apps/files/lib/BackgroundJob/CleanupDirectEditingTokens.php
@@ -7,7 +7,7 @@ use OCP\DirectEditing\IManager;
 
 class CleanupDirectEditingTokens extends TimedJob {
 
-	const INTERVAL_MINUTES = 15 * 60;
+	private const INTERVAL_MINUTES = 15 * 60;
 
 	/**
 	 * @var IManager
diff --git a/apps/files/lib/Capabilities.php b/apps/files/lib/Capabilities.php
index c37e32b6b59a5a86669fe8884a0dd51dad1eb569..19b59971c4cf6377ab293d2325837a57bfc1b079 100644
--- a/apps/files/lib/Capabilities.php
+++ b/apps/files/lib/Capabilities.php
@@ -30,6 +30,8 @@ use OCP\Capabilities\ICapability;
 use OCP\DirectEditing\ACreateEmpty;
 use OCP\DirectEditing\ACreateFromTemplate;
 use OCP\DirectEditing\IEditor;
+use OCP\DirectEditing\RegisterDirectEditorEvent;
+use OCP\EventDispatcher\IEventDispatcher;
 use OCP\IConfig;
 
 /**
@@ -38,17 +40,25 @@ use OCP\IConfig;
  * @package OCA\Files
  */
 class Capabilities implements ICapability {
+
 	/** @var IConfig */
 	protected $config;
 
+	/** @var Manager */
+	protected $directEditingManager;
+
+	/** @var IEventDispatcher */
+	protected $eventDispatcher;
+
 	/**
 	 * Capabilities constructor.
 	 *
 	 * @param IConfig $config
 	 */
-	public function __construct(IConfig $config, Manager $manager) {
+	public function __construct(IConfig $config, Manager $manager, IEventDispatcher $eventDispatcher) {
 		$this->config = $config;
 		$this->directEditingManager = $manager;
+		$this->eventDispatcher = $eventDispatcher;
 	}
 
 	/**
@@ -66,7 +76,9 @@ class Capabilities implements ICapability {
 		];
 	}
 
-	private function getDirectEditingCapabilitites() {
+	private function getDirectEditingCapabilitites(): array {
+		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
+
 		$capabilities = [
 			'editors' => [],
 			'creators' => []
diff --git a/apps/files/lib/Controller/DirectEditingController.php b/apps/files/lib/Controller/DirectEditingController.php
index e8791316442dce2da95cb12616b904efea61e0af..11d09e2f074b7cab94c6a9030f4a0a81c5d79bd4 100644
--- a/apps/files/lib/Controller/DirectEditingController.php
+++ b/apps/files/lib/Controller/DirectEditingController.php
@@ -66,7 +66,7 @@ class DirectEditingController extends OCSController {
 	 * @NoAdminRequired
 	 */
 	public function create(string $path, string $editorId, string $creatorId, string $templateId = null): DataResponse {
-		$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
+		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
 
 		try {
 			$token = $this->directEditingManager->create($path, $editorId, $creatorId, $templateId);
@@ -83,7 +83,7 @@ class DirectEditingController extends OCSController {
 	 * @NoAdminRequired
 	 */
 	public function open(int $fileId, string $editorId = null): DataResponse {
-		$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
+		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
 
 		try {
 			$token = $this->directEditingManager->open($fileId, $editorId);
@@ -102,7 +102,7 @@ class DirectEditingController extends OCSController {
 	 * @NoAdminRequired
 	 */
 	public function templates(string $editorId, string $creatorId): DataResponse {
-		$this->eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this->directEditingManager));
+		$this->eventDispatcher->dispatchTyped(new RegisterDirectEditorEvent($this->directEditingManager));
 
 		try {
 			return new DataResponse($this->directEditingManager->getTemplates($editorId, $creatorId));
diff --git a/core/Migrations/Version18000Date20191014105105.php b/core/Migrations/Version18000Date20191014105105.php
index b291c0b5e468ea1d8121e625b363e48ff6239f4a..634f9f91faf39ffff8a0a506edf96f354394f587 100644
--- a/core/Migrations/Version18000Date20191014105105.php
+++ b/core/Migrations/Version18000Date20191014105105.php
@@ -50,44 +50,42 @@ class Version18000Date20191014105105 extends SimpleMigrationStep {
 	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
 		/** @var ISchemaWrapper $schema */
 		$schema = $schemaClosure();
-		if (!$schema->hasTable('direct_edit')) {
-			$table = $schema->createTable('direct_edit');
+		$table = $schema->createTable('direct_edit');
 
-			$table->addColumn('id', Type::BIGINT, [
-				'autoincrement' => true,
-				'notnull' => true,
-			]);
-			$table->addColumn('editor_id', Type::STRING, [
-				'notnull' => true,
-				'length' => 64,
-			]);
-			$table->addColumn('token', Type::STRING, [
-				'notnull' => true,
-				'length' => 64,
-			]);
-			$table->addColumn('file_id', Type::BIGINT, [
-				'notnull' => true,
-			]);
-			$table->addColumn('user_id', Type::STRING, [
-				'notnull' => false,
-				'length' => 64,
-			]);
-			$table->addColumn('share_id', Type::BIGINT, [
-				'notnull' => false
-			]);
-			$table->addColumn('timestamp', Type::BIGINT, [
-				'notnull' => true,
-				'length' => 20,
-				'unsigned' => true,
-			]);
-			$table->addColumn('accessed', Type::BOOLEAN, [
-				'notnull' => true,
-				'default' => false
-			]);
+		$table->addColumn('id', Type::BIGINT, [
+			'autoincrement' => true,
+			'notnull' => true,
+		]);
+		$table->addColumn('editor_id', Type::STRING, [
+			'notnull' => true,
+			'length' => 64,
+		]);
+		$table->addColumn('token', Type::STRING, [
+			'notnull' => true,
+			'length' => 64,
+		]);
+		$table->addColumn('file_id', Type::BIGINT, [
+			'notnull' => true,
+		]);
+		$table->addColumn('user_id', Type::STRING, [
+			'notnull' => false,
+			'length' => 64,
+		]);
+		$table->addColumn('share_id', Type::BIGINT, [
+			'notnull' => false
+		]);
+		$table->addColumn('timestamp', Type::BIGINT, [
+			'notnull' => true,
+			'length' => 20,
+			'unsigned' => true,
+		]);
+		$table->addColumn('accessed', Type::BOOLEAN, [
+			'notnull' => true,
+			'default' => false
+		]);
 
-			$table->setPrimaryKey(['id']);
-			$table->addIndex(['token']);
-		}
+		$table->setPrimaryKey(['id']);
+		$table->addIndex(['token']);
 
 		return $schema;
 	}
diff --git a/lib/private/DirectEditing/Manager.php b/lib/private/DirectEditing/Manager.php
index fdf0a1f0f0f6fc5c66cca53a4d969b2f4c41ab4b..26adad9e5729089b7861395d5103680a838105c4 100644
--- a/lib/private/DirectEditing/Manager.php
+++ b/lib/private/DirectEditing/Manager.php
@@ -64,15 +64,12 @@ class Manager implements IManager {
 		ISecureRandom $random,
 		IDBConnection $connection,
 		IUserSession $userSession,
-		IRootFolder $rootFolder,
-		IEventDispatcher $eventDispatcher
+		IRootFolder $rootFolder
 	) {
 		$this->random = $random;
 		$this->connection = $connection;
 		$this->userId = $userSession->getUser() ? $userSession->getUser()->getUID() : null;
 		$this->rootFolder = $rootFolder;
-		$eventDispatcher->dispatch(RegisterDirectEditorEvent::class, new RegisterDirectEditorEvent($this));
-
 	}
 
 	public function registerDirectEditor(IEditor $directEditor): void {
diff --git a/lib/public/DirectEditing/ACreateFromTemplate.php b/lib/public/DirectEditing/ACreateFromTemplate.php
index a731e8be59581042bb4e0071fe9eb5fea6ae013c..89420a63743b4e071ca922588524b43be9bd4fed 100644
--- a/lib/public/DirectEditing/ACreateFromTemplate.php
+++ b/lib/public/DirectEditing/ACreateFromTemplate.php
@@ -32,7 +32,7 @@ abstract class ACreateFromTemplate extends ACreateEmpty {
 	 * List of available templates for the create from template action
 	 *
 	 * @since 18.0.0
-	 * @return array
+	 * @return ATemplate[]
 	 */
 	abstract public function getTemplates(): array;
 
diff --git a/lib/public/DirectEditing/IEditor.php b/lib/public/DirectEditing/IEditor.php
index a4fc87f7e15e238315253b1e8297fb211a71178c..a2bc0d74255f0aa576cd4c8d46f480d744b01952 100644
--- a/lib/public/DirectEditing/IEditor.php
+++ b/lib/public/DirectEditing/IEditor.php
@@ -56,7 +56,7 @@ interface IEditor {
 	 * A list of mimetypes that should open the editor by default
 	 *
 	 * @since 18.0.0
-	 * @return array
+	 * @return string[]
 	 */
 	public function getMimetypes(): array;
 
@@ -64,7 +64,7 @@ interface IEditor {
 	 * A list of mimetypes that can be opened in the editor optionally
 	 *
 	 * @since 18.0.0
-	 * @return array
+	 * @return string[]
 	 */
 	public function getMimetypesOptional(): array;
 
@@ -72,7 +72,7 @@ interface IEditor {
 	 * Return a list of file creation options to be presented to the user
 	 *
 	 * @since 18.0.0
-	 * @return array of ICreateFromTemplate|ICreateEmpty
+	 * @return ACreateFromTemplate[]|ACreateEmpty[]
 	 */
 	public function getCreators(): array;
 
diff --git a/tests/lib/DirectEditing/ManagerTest.php b/tests/lib/DirectEditing/ManagerTest.php
index b2e58efd8e233d3445ce08264556a8a4d874e131..a3d29efbce5b6ad8564c3986da5a22948c53b248 100644
--- a/tests/lib/DirectEditing/ManagerTest.php
+++ b/tests/lib/DirectEditing/ManagerTest.php
@@ -7,7 +7,6 @@ use OC\Files\Node\File;
 use OCP\AppFramework\Http\DataResponse;
 use OCP\AppFramework\Http\NotFoundResponse;
 use OCP\AppFramework\Http\Response;
-use OCP\AppFramework\Http\TemplateResponse;
 use OCP\DirectEditing\ACreateEmpty;
 use OCP\DirectEditing\IEditor;
 use OCP\DirectEditing\IToken;
@@ -16,6 +15,7 @@ use OCP\Files\IRootFolder;
 use OCP\IDBConnection;
 use OCP\IUserSession;
 use OCP\Security\ISecureRandom;
+use PHPUnit\Framework\MockObject\MockObject;
 use Test\TestCase;
 
 class CreateEmpty extends ACreateEmpty {
@@ -82,9 +82,25 @@ class ManagerTest extends TestCase {
 	 */
 	private $editor;
 	/**
-	 * @var \PHPUnit\Framework\MockObject\MockObject
+	 * @var MockObject|ISecureRandom
 	 */
 	private $random;
+	/**
+	 * @var IDBConnection
+	 */
+	private $connection;
+	/**
+	 * @var MockObject|IUserSession
+	 */
+	private $userSession;
+	/**
+	 * @var MockObject|IRootFolder
+	 */
+	private $rootFolder;
+	/**
+	 * @var MockObject|Folder
+	 */
+	private $userFolder;
 
 	protected function setUp() {
 		parent::setUp();