Skip to content

Commit ca9c197

Browse files
committed
php 8.1 compat
1 parent b1a7cb5 commit ca9c197

File tree

6 files changed

+56
-17
lines changed

6 files changed

+56
-17
lines changed

lib/aws-sdk/Aws/Common/Credentials/Credentials.php

+18
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,24 @@ public function unserialize($serialized)
196196
$this->ttd = $data[Options::TOKEN_TTD];
197197
}
198198

199+
public function __unserialize($data)
200+
{
201+
$this->key = $data[Options::KEY];
202+
$this->secret = $data[Options::SECRET];
203+
$this->token = $data[Options::TOKEN];
204+
$this->ttd = $data[Options::TOKEN_TTD];
205+
}
206+
207+
public function __serialize(): array
208+
{
209+
return array(
210+
Options::KEY => $this->key,
211+
Options::SECRET => $this->secret,
212+
Options::TOKEN => $this->token,
213+
Options::TOKEN_TTD => $this->ttd
214+
);
215+
}
216+
199217
public function getAccessKeyId()
200218
{
201219
return $this->key;

lib/aws-sdk/Guzzle/Common/Collection.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ public static function fromConfig(array $config = array(), array $defaults = arr
4242
return new self($data);
4343
}
4444

45-
public function count()
45+
public function count(): int
4646
{
4747
return count($this->data);
4848
}
4949

50-
public function getIterator()
50+
public function getIterator(): \Traversable
5151
{
5252
return new \ArrayIterator($this->data);
5353
}
@@ -291,22 +291,22 @@ public function filter(\Closure $closure, $static = true)
291291
return $collection;
292292
}
293293

294-
public function offsetExists($offset)
294+
public function offsetExists($offset): bool
295295
{
296296
return isset($this->data[$offset]);
297297
}
298298

299-
public function offsetGet($offset)
299+
public function offsetGet($offset): mixed
300300
{
301301
return isset($this->data[$offset]) ? $this->data[$offset] : null;
302302
}
303303

304-
public function offsetSet($offset, $value)
304+
public function offsetSet($offset, $value): void
305305
{
306306
$this->data[$offset] = $value;
307307
}
308308

309-
public function offsetUnset($offset)
309+
public function offsetUnset($offset): void
310310
{
311311
unset($this->data[$offset]);
312312
}

lib/aws-sdk/Guzzle/Common/Event.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ public function __construct(array $context = array())
2020
$this->context = $context;
2121
}
2222

23-
public function getIterator()
23+
public function getIterator(): \Traversable
2424
{
2525
return new \ArrayIterator($this->context);
2626
}
2727

28-
public function offsetGet($offset)
28+
public function offsetGet($offset): mixed
2929
{
3030
return isset($this->context[$offset]) ? $this->context[$offset] : null;
3131
}
3232

33-
public function offsetSet($offset, $value)
33+
public function offsetSet($offset, $value): void
3434
{
3535
$this->context[$offset] = $value;
3636
}
3737

38-
public function offsetExists($offset)
38+
public function offsetExists($offset): bool
3939
{
4040
return isset($this->context[$offset]);
4141
}
4242

43-
public function offsetUnset($offset)
43+
public function offsetUnset($offset): void
4444
{
4545
unset($this->context[$offset]);
4646
}

lib/aws-sdk/Guzzle/Service/Builder/ServiceBuilder.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,21 @@ public function unserialize($serialized)
7070
$this->builderConfig = json_decode($serialized, true);
7171
}
7272

73+
public function __unserialize($data)
74+
{
75+
$this->builderConfig = $data;
76+
}
77+
7378
public function serialize()
7479
{
7580
return json_encode($this->builderConfig);
7681
}
7782

83+
public function __serialize(): array
84+
{
85+
return $this->builderConfig;
86+
}
87+
7888
/**
7989
* Attach a plugin to every client created by the builder
8090
*
@@ -166,23 +176,23 @@ public function set($key, $service)
166176
return $this;
167177
}
168178

169-
public function offsetSet($offset, $value)
179+
public function offsetSet($offset, $value): void
170180
{
171181
$this->set($offset, $value);
172182
}
173183

174-
public function offsetUnset($offset)
184+
public function offsetUnset($offset): void
175185
{
176186
unset($this->builderConfig[$offset]);
177187
unset($this->clients[$offset]);
178188
}
179189

180-
public function offsetExists($offset)
190+
public function offsetExists($offset): bool
181191
{
182192
return isset($this->builderConfig[$offset]) || isset($this->clients[$offset]);
183193
}
184194

185-
public function offsetGet($offset)
195+
public function offsetGet($offset): mixed
186196
{
187197
return $this->get($offset);
188198
}

lib/aws-sdk/Guzzle/Service/Command/Factory/CompositeFactory.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ public function factory($name, array $args = array())
142142
}
143143
}
144144

145-
public function count()
145+
public function count(): int
146146
{
147147
return count($this->factories);
148148
}
149149

150-
public function getIterator()
150+
public function getIterator(): \Traversable
151151
{
152152
return new \ArrayIterator($this->factories);
153153
}

lib/aws-sdk/Guzzle/Service/Description/ServiceDescription.php

+11
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ public function unserialize($json)
7171
$this->fromArray(json_decode($json, true));
7272
}
7373

74+
public function __unserialize($data)
75+
{
76+
$this->operations = array();
77+
$this->fromArray($data);
78+
}
79+
80+
public function __serialize(): array
81+
{
82+
return $this->toArray();
83+
}
84+
7485
public function toArray()
7586
{
7687
$result = array(

0 commit comments

Comments
 (0)