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 16, 2023
1 parent b1a7cb5 commit ca9c197
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 17 deletions.
18 changes: 18 additions & 0 deletions lib/aws-sdk/Aws/Common/Credentials/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,24 @@ public function unserialize($serialized)
$this->ttd = $data[Options::TOKEN_TTD];
}

public function __unserialize($data)
{
$this->key = $data[Options::KEY];
$this->secret = $data[Options::SECRET];
$this->token = $data[Options::TOKEN];
$this->ttd = $data[Options::TOKEN_TTD];
}

public function __serialize(): array
{
return array(
Options::KEY => $this->key,
Options::SECRET => $this->secret,
Options::TOKEN => $this->token,
Options::TOKEN_TTD => $this->ttd
);
}

public function getAccessKeyId()
{
return $this->key;
Expand Down
12 changes: 6 additions & 6 deletions lib/aws-sdk/Guzzle/Common/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public static function fromConfig(array $config = array(), array $defaults = arr
return new self($data);
}

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

public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->data);
}
Expand Down Expand Up @@ -291,22 +291,22 @@ public function filter(\Closure $closure, $static = true)
return $collection;
}

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

public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}

public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->data[$offset] = $value;
}

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->data[$offset]);
}
Expand Down
10 changes: 5 additions & 5 deletions lib/aws-sdk/Guzzle/Common/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ public function __construct(array $context = array())
$this->context = $context;
}

public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->context);
}

public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return isset($this->context[$offset]) ? $this->context[$offset] : null;
}

public function offsetSet($offset, $value)
public function offsetSet($offset, $value): void
{
$this->context[$offset] = $value;
}

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

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->context[$offset]);
}
Expand Down
18 changes: 14 additions & 4 deletions lib/aws-sdk/Guzzle/Service/Builder/ServiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,21 @@ public function unserialize($serialized)
$this->builderConfig = json_decode($serialized, true);
}

public function __unserialize($data)
{
$this->builderConfig = $data;
}

public function serialize()
{
return json_encode($this->builderConfig);
}

public function __serialize(): array
{
return $this->builderConfig;
}

/**
* Attach a plugin to every client created by the builder
*
Expand Down Expand Up @@ -166,23 +176,23 @@ public function set($key, $service)
return $this;
}

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

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

public function offsetExists($offset)
public function offsetExists($offset): bool
{
return isset($this->builderConfig[$offset]) || isset($this->clients[$offset]);
}

public function offsetGet($offset)
public function offsetGet($offset): mixed
{
return $this->get($offset);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ public function factory($name, array $args = array())
}
}

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

public function getIterator()
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->factories);
}
Expand Down
11 changes: 11 additions & 0 deletions lib/aws-sdk/Guzzle/Service/Description/ServiceDescription.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ public function unserialize($json)
$this->fromArray(json_decode($json, true));
}

public function __unserialize($data)
{
$this->operations = array();
$this->fromArray($data);
}

public function __serialize(): array
{
return $this->toArray();
}

public function toArray()
{
$result = array(
Expand Down

0 comments on commit ca9c197

Please sign in to comment.