Skip to content

Commit

Permalink
php 8.1 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
romainmenke committed Oct 17, 2023
1 parent c987454 commit 2b6c8b5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function offsetExists($offset): bool
return isset($this->headers[strtolower($offset)]);
}

public function offsetGet($offset)
public function offsetGet($offset): mixed
{
$l = strtolower($offset);

Expand Down
14 changes: 14 additions & 0 deletions lib/aws-sdk/Guzzle/Http/Message/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ public function unserialize($serialize)
$this->__construct($data['status'], $data['headers'], $data['body']);
}

public function __serialize(): array
{
return array(
'status' => $this->statusCode,
'body' => (string) $this->body,
'headers' => $this->headers->toArray()
);
}

public function __unserialize(array $data): void
{
$this->__construct($data['status'], $data['headers'], $data['body']);
}

/**
* Get the response entity body
*
Expand Down
12 changes: 6 additions & 6 deletions lib/aws-sdk/Guzzle/Service/Resource/ResourceIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ public function set($key, $value)
return $this;
}

public function current()
public function current(): mixed
{
return $this->resources ? current($this->resources) : false;
}

public function key()
public function key(): mixed
{
return max(0, $this->iteratedCount - 1);
}

public function count()
public function count(): int
{
return $this->retrievedCount;
}
Expand All @@ -149,21 +149,21 @@ public function getRequestCount()
/**
* Rewind the Iterator to the first element and send the original command
*/
public function rewind()
public function rewind(): void
{
// Use the original command
$this->command = clone $this->originalCommand;
$this->resetState();
$this->next();
}

public function valid()
public function valid(): bool
{
return !$this->invalid && (!$this->resources || $this->current() || $this->nextToken)
&& (!$this->limit || $this->iteratedCount < $this->limit + 1);
}

public function next()
public function next(): void
{
$this->iteratedCount++;

Expand Down

0 comments on commit 2b6c8b5

Please sign in to comment.