Skip to content

Commit

Permalink
Merge pull request #5 from basil-inc/master
Browse files Browse the repository at this point in the history
[#4] Add return types to methods inherited from PHP ArrayAccess
  • Loading branch information
honzabrecka authored Nov 21, 2023
2 parents 1a0392b + 4030bf9 commit 5f100a8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/transit/CMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private function stringify($value) {
return (string)$value;
}

public function offsetSet($offset, $value) {
public function offsetSet($offset, $value): void {
$hash = $this->hash($offset);

if (isset($this->hashes[$hash])) {
Expand All @@ -51,11 +51,11 @@ public function offsetSet($offset, $value) {
$this->index = $this->index + 2;
}

public function offsetExists($offset) {
public function offsetExists($offset): bool {
return isset($this->hashes[$this->hash($offset)]);
}

public function offsetUnset($offset) {
public function offsetUnset($offset): void {
$hash = $this->hash($offset);
$index = $this->hashes[$hash];
unset($this->hashes[$hash]);
Expand All @@ -68,7 +68,7 @@ public function offsetUnset($offset) {
}, $this->hashes);
}

public function offsetGet($offset) {
public function offsetGet($offset): mixed {
return $this->data[$this->hashes[$this->hash($offset)] + 1];
}

Expand Down
8 changes: 4 additions & 4 deletions src/transit/Map.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function stringify($value) {
return (string)$value;
}

public function offsetSet($offset, $value) {
public function offsetSet($offset, $value): void {
$hash = $this->hash($offset);

if (isset($this->hashes[$hash])) {
Expand All @@ -63,11 +63,11 @@ public function offsetSet($offset, $value) {
$this->index = $this->index + 2;
}

public function offsetExists($offset) {
public function offsetExists($offset): bool {
return isset($this->hashes[$this->hash($offset)]);
}

public function offsetUnset($offset) {
public function offsetUnset($offset): void {
$hash = $this->hash($offset);
$index = $this->hashes[$hash];
unset($this->hashes[$hash]);
Expand All @@ -80,7 +80,7 @@ public function offsetUnset($offset) {
}, $this->hashes);
}

public function offsetGet($offset) {
public function offsetGet($offset): mixed {
return $this->data[$this->hashes[$this->hash($offset)] + 1];
}

Expand Down

0 comments on commit 5f100a8

Please sign in to comment.