Skip to content

Commit baaa503

Browse files
authored
Replace if/else with return match
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
1 parent 2188505 commit baaa503

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

lib/private/Files/FileInfo.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,14 @@ public function offsetUnset($offset): void {
119119
*/
120120
#[\ReturnTypeWillChange]
121121
public function offsetGet($offset) {
122-
if ($offset === 'type') {
123-
return $this->getType();
124-
} elseif ($offset === 'etag') {
125-
return $this->getEtag();
126-
} elseif ($offset === 'size') {
127-
return $this->getSize();
128-
} elseif ($offset === 'mtime') {
129-
return $this->getMTime();
130-
} elseif ($offset === 'permissions') {
131-
return $this->getPermissions();
132-
} elseif (isset($this->data[$offset])) {
133-
return $this->data[$offset];
134-
} else {
135-
return null;
136-
}
122+
return match ($offset) {
123+
'type' => $this->getType(),
124+
'etag' => $this->getEtag(),
125+
'size' => $this->getSize(),
126+
'mtime' => $this->getMTime(),
127+
'permissions' => $this->getPermissions(),
128+
default => $this->data[$offset] ?? null,
129+
};
137130
}
138131

139132
/**

0 commit comments

Comments
 (0)