aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/EventDispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/EventDispatcher')
-rw-r--r--lib/public/EventDispatcher/GenericEvent.php4
-rw-r--r--lib/public/EventDispatcher/JsonSerializer.php16
2 files changed, 15 insertions, 5 deletions
diff --git a/lib/public/EventDispatcher/GenericEvent.php b/lib/public/EventDispatcher/GenericEvent.php
index fb0a7677672..7e646c4d6a7 100644
--- a/lib/public/EventDispatcher/GenericEvent.php
+++ b/lib/public/EventDispatcher/GenericEvent.php
@@ -18,10 +18,12 @@ use function array_key_exists;
/**
* Class GenericEvent
*
- * convenience reimplementation of \Symfony\Component\GenericEvent against
+ * convenience re-implementation of \Symfony\Component\GenericEvent against
* \OCP\EventDispatcher\Event
*
* @since 18.0.0
+ * @template-implements ArrayAccess<array-key, mixed>
+ * @template-implements IteratorAggregate<array-key, mixed>
* @deprecated 22.0.0 use \OCP\EventDispatcher\Event
*/
class GenericEvent extends Event implements ArrayAccess, IteratorAggregate {
diff --git a/lib/public/EventDispatcher/JsonSerializer.php b/lib/public/EventDispatcher/JsonSerializer.php
index 1eb75ed7527..d05367b746d 100644
--- a/lib/public/EventDispatcher/JsonSerializer.php
+++ b/lib/public/EventDispatcher/JsonSerializer.php
@@ -9,6 +9,8 @@ declare(strict_types=1);
namespace OCP\EventDispatcher;
+use OC\Files\Node\NonExistingFile;
+use OC\Files\Node\NonExistingFolder;
use OCP\Files\FileInfo;
use OCP\IUser;
@@ -24,10 +26,16 @@ final class JsonSerializer {
* @since 30.0.0
*/
public static function serializeFileInfo(FileInfo $node): array {
- return [
- 'id' => $node->getId(),
- 'path' => $node->getPath(),
- ];
+ if ($node instanceof NonExistingFile || $node instanceof NonExistingFolder) {
+ return [
+ 'path' => $node->getPath(),
+ ];
+ } else {
+ return [
+ 'id' => $node->getId(),
+ 'path' => $node->getPath(),
+ ];
+ }
}
/**