aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGit'Fellow <12234510+solracsf@users.noreply.github.com>2023-11-15 00:05:52 +0100
committerGitHub <noreply@github.com>2023-11-15 00:05:52 +0100
commite0cafc8fe8e3249eed3dc5ad99b46cd8797a4e89 (patch)
treeded2f857e69770b33f59fa74d59880a69d05529b /lib
parent9e7fc23bd077102176a802e60cbe44bfbfba6a3f (diff)
parent3bedfdf6ff35177d532f3e8017bcf7cde4eb9011 (diff)
downloadnextcloud-server-e0cafc8fe8e3249eed3dc5ad99b46cd8797a4e89.tar.gz
nextcloud-server-e0cafc8fe8e3249eed3dc5ad99b46cd8797a4e89.zip
Merge pull request #38622 from nextcloud/ifElseReturnMatch
Replace if/else with return match
Diffstat (limited to 'lib')
-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 4ef32861f24..5ba2f27b78b 100644
--- a/lib/private/Files/FileInfo.php
+++ b/lib/private/Files/FileInfo.php
@@ -123,21 +123,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,
+ };
}
/**