mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
Merge pull request #38622 from nextcloud/ifElseReturnMatch
Replace if/else with return match
This commit is contained in:
commit
e0cafc8fe8
1 changed files with 8 additions and 15 deletions
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue