aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-06-02 19:38:03 +0200
committerGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-11-01 10:33:42 +0100
commit3bedfdf6ff35177d532f3e8017bcf7cde4eb9011 (patch)
tree8e8bdf76a5f9e8db45e77bf21f652c0a34247798
parent5d05da0f8da263945a0bb118167b4c9d115b36b2 (diff)
downloadnextcloud-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.php23
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,
+ };
}
/**