Skip to content

Commit

Permalink
Merge pull request #47784 from nextcloud/fix/file-info
Browse files Browse the repository at this point in the history
fix(FileInfo): correctly implement `\ArrayAccess::offsetGet`
  • Loading branch information
susnux authored Sep 6, 2024
2 parents 141fed8 + a964060 commit ba73bea
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions lib/private/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ public function offsetUnset($offset): void {
unset($this->data[$offset]);
}

/**
* @return mixed
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset) {
public function offsetGet(mixed $offset): mixed {
return match ($offset) {
'type' => $this->getType(),
'etag' => $this->getEtag(),
Expand Down Expand Up @@ -164,7 +160,7 @@ public function getName() {
* @return string
*/
public function getEtag() {
$this->updateEntryfromSubMounts();
$this->updateEntryFromSubMounts();
if (count($this->childEtags) > 0) {
$combinedEtag = $this->data['etag'] . '::' . implode('::', $this->childEtags);
return md5($combinedEtag);
Expand All @@ -179,7 +175,7 @@ public function getEtag() {
*/
public function getSize($includeMounts = true) {
if ($includeMounts) {
$this->updateEntryfromSubMounts();
$this->updateEntryFromSubMounts();

if ($this->isEncrypted() && isset($this->data['unencrypted_size']) && $this->data['unencrypted_size'] > 0) {
return $this->data['unencrypted_size'];
Expand All @@ -195,7 +191,7 @@ public function getSize($includeMounts = true) {
* @return int
*/
public function getMTime() {
$this->updateEntryfromSubMounts();
$this->updateEntryFromSubMounts();
return (int)$this->data['mtime'];
}

Expand Down Expand Up @@ -318,7 +314,7 @@ public function setSubMounts(array $mounts) {
$this->subMounts = $mounts;
}

private function updateEntryfromSubMounts(): void {
private function updateEntryFromSubMounts(): void {
if ($this->subMountsUsed) {
return;
}
Expand Down

0 comments on commit ba73bea

Please sign in to comment.