diff options
author | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-06-02 19:38:03 +0200 |
---|---|---|
committer | Git'Fellow <12234510+solracsf@users.noreply.github.com> | 2023-11-01 10:33:42 +0100 |
commit | 3bedfdf6ff35177d532f3e8017bcf7cde4eb9011 (patch) | |
tree | 8e8bdf76a5f9e8db45e77bf21f652c0a34247798 | |
parent | 5d05da0f8da263945a0bb118167b4c9d115b36b2 (diff) | |
download | nextcloud-server-3bedfdf6ff35177d532f3e8017bcf7cde4eb9011.tar.gz nextcloud-server-3bedfdf6ff35177d532f3e8017bcf7cde4eb9011.zip |
Replace if/else with return match
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
-rw-r--r-- | lib/private/Files/FileInfo.php | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index 7800074460b..21284aca49d 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -121,21 +121,14 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { */ #[\ReturnTypeWillChange] public function offsetGet($offset) { - if ($offset === 'type') { - return $this->getType(); - } elseif ($offset === 'etag') { - return $this->getEtag(); - } elseif ($offset === 'size') { - return $this->getSize(); - } elseif ($offset === 'mtime') { - return $this->getMTime(); - } elseif ($offset === 'permissions') { - return $this->getPermissions(); - } elseif (isset($this->data[$offset])) { - return $this->data[$offset]; - } else { - return null; - } + return match ($offset) { + 'type' => $this->getType(), + 'etag' => $this->getEtag(), + 'size' => $this->getSize(), + 'mtime' => $this->getMTime(), + 'permissions' => $this->getPermissions(), + default => $this->data[$offset] ?? null, + }; } /** |