diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2024-05-02 17:09:02 +0100 |
---|---|---|
committer | fenn-cs <fenn25.fn@gmail.com> | 2024-05-02 17:09:10 +0100 |
commit | 8089ca5291d23f355ccc5b5b8b414f6ba0066a25 (patch) | |
tree | 7e232f5f1c237098993844e339a26f7f6708c0db | |
parent | 321900d03238308029c503493594704275f0ea1a (diff) | |
download | nextcloud-server-noissue-refactor-share-class.tar.gz nextcloud-server-noissue-refactor-share-class.zip |
refactor(IShare): use strong typing for propsnoissue-refactor-share-class
The `IShare` interfaces and it's resulting implementations currently only implement types via annotations.
There is need to implement strong typing and refactor usage of share objects to ONLY ACCESS initialized properties.
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
-rw-r--r-- | lib/private/Share20/Share.php | 81 |
1 files changed, 27 insertions, 54 deletions
diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index e1d8818216b..e1132ad879a 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -41,61 +41,34 @@ use OCP\Share\IAttributes; use OCP\Share\IShare; class Share implements IShare { - /** @var string */ - private $id; - /** @var string */ - private $providerId; - /** @var Node */ - private $node; - /** @var int */ - private $fileId; - /** @var string */ - private $nodeType; - /** @var int */ - private $shareType; - /** @var string */ - private $sharedWith; - /** @var string */ - private $sharedWithDisplayName; - /** @var string */ - private $sharedWithAvatar; - /** @var string */ - private $sharedBy; - /** @var string */ - private $shareOwner; - /** @var int */ - private $permissions; - /** @var IAttributes */ - private $attributes; - /** @var int */ - private $status; - /** @var string */ - private $note = ''; - /** @var \DateTime */ - private $expireDate; - /** @var string */ - private $password; + private ?string $id = null; + private ?string $providerId = null; + private ?Node $node = null; + private ?int $fileId = null; + private ?string $nodeType = null; + private ?int $shareType = null; + private ?string $sharedWith = null; + private ?string $sharedWithDisplayName = null; + private ?string $sharedWithAvatar = null; + private ?string $sharedBy = null; + private ?string $shareOwner = null; + private ?int $permissions = null; + private ?IAttributes $attributes = null; + private ?int $status = null; + private ?string $note = null; + private ?\DateTime $expireDate = null; + private bool $overwriteFalsyExpirationDate = true; + private ?string $password = null; private ?\DateTimeInterface $passwordExpirationTime = null; - /** @var bool */ - private $sendPasswordByTalk = false; - /** @var string */ - private $token; - /** @var int */ - private $parent; - /** @var string */ - private $target; - /** @var \DateTime */ - private $shareTime; - /** @var bool */ - private $mailSend; - /** @var string */ - private $label = ''; - - /** @var ICacheEntry|null */ - private $nodeCacheEntry; - - /** @var bool */ - private $hideDownload = false; + private bool $sendPasswordByTalk = false; + private ?string $token = null; + private ?int $parent = null; + private ?string $target = null; + private ?\DateTime $shareTime = null; + private bool $mailSend = false; + private ?string $label = ''; + private ?ICacheEntry $nodeCacheEntry = null; + private bool $hideDownload = false; public function __construct( private IRootFolder $rootFolder, |