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 ca9c197 commit c987454
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 17 deletions.
4 changes: 2 additions & 2 deletions lib/aws-sdk/Guzzle/Common/Exception/ExceptionCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function add($e)
*
* @return int
*/
public function count()
public function count(): int
{
return count($this->exceptions);
}
Expand All @@ -70,7 +70,7 @@ public function count()
*
* @return \ArrayIterator
*/
public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->exceptions);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/aws-sdk/Guzzle/Http/Curl/CurlMulti.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function send()
}
}

public function count()
public function count(): int
{
return count($this->requests);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/aws-sdk/Guzzle/Http/Curl/CurlMultiProxy.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function send()
}
}

public function count()
public function count(): int
{
return count($this->all());
}
Expand Down
4 changes: 2 additions & 2 deletions lib/aws-sdk/Guzzle/Http/Message/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public function toArray()
return $this->values;
}

public function count()
public function count(): int
{
return count($this->toArray());
}

public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->toArray());
}
Expand Down
10 changes: 5 additions & 5 deletions lib/aws-sdk/Guzzle/Http/Message/Header/HeaderCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function get($key)
return $this->offsetGet($key);
}

public function count()
public function count(): int
{
return count($this->headers);
}

public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->headers[strtolower($offset)]);
}
Expand All @@ -81,17 +81,17 @@ public function offsetGet($offset)
return isset($this->headers[$l]) ? $this->headers[$l] : null;
}

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

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->headers[strtolower($offset)]);
}

public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->headers);
}
Expand Down
8 changes: 7 additions & 1 deletion lib/aws-sdk/Guzzle/Http/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function factory($url)
$parts += $defaults;

// Convert the query string into a QueryString object
if ($parts['query'] || 0 !== strlen($parts['query'])) {
if ($parts['query'] || 0 !== strlen($parts['query'] ?? '')) {
$parts['query'] = QueryString::fromString($parts['query']);
}

Expand Down Expand Up @@ -280,6 +280,12 @@ public function setPath($path)
$path = '/' . implode('/', $path);
}

if ($path === null) {
$this->path = null;

return $this;
}

$this->path = strtr($path, $pathReplace);

return $this;
Expand Down
2 changes: 1 addition & 1 deletion lib/aws-sdk/Guzzle/Iterator/AppendIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AppendIterator extends \AppendIterator
*
* @param \Iterator $iterator Iterator to append
*/
public function append(\Iterator $iterator)
public function append(\Iterator $iterator): void
{
$this->getArrayIterator()->append($iterator);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/aws-sdk/Guzzle/Iterator/ChunkedIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public function __construct(\Traversable $iterator, $chunkSize)
$this->chunkSize = $chunkSize;
}

public function rewind()
public function rewind(): void
{
parent::rewind();
$this->next();
}

public function next()
public function next(): void
{
$this->chunk = array();
for ($i = 0; $i < $this->chunkSize && parent::valid(); $i++) {
Expand All @@ -49,7 +49,7 @@ public function current()
return $this->chunk;
}

public function valid()
public function valid(): bool
{
return (bool) $this->chunk;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/aws-sdk/Guzzle/Iterator/FilterIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(\Iterator $iterator, $callback)
$this->callback = $callback;
}

public function accept()
public function accept(): bool
{
return call_user_func($this->callback, $this->current());
}
Expand Down

0 comments on commit c987454

Please sign in to comment.