Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more ReturnTypeWillChange attributes #2284

Merged
merged 5 commits into from
Aug 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Api/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,26 @@ public function toArray()
return $this->definition;
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return isset($this->definition[$offset])
? $this->definition[$offset] : null;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->definition[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->definition[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->definition[$offset]);
Expand Down
4 changes: 1 addition & 3 deletions src/Api/DateTimeResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Aws\Api\Parser\Exception\ParserException;
use Exception;
use \ReturnTypeWillChange;

/**
* DateTime overrides that make DateTime work more seamlessly as a string,
Expand Down Expand Up @@ -95,10 +94,9 @@ public function __toString()
*
* @return mixed|string
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return (string) $this;
}
}

6 changes: 6 additions & 0 deletions src/CloudTrail/LogRecordIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,13 @@ public function __construct(
*
* @return array|false
*/
#[\ReturnTypeWillChange]
public function current()
{
return $this->valid() ? $this->records[$this->recordIndex] : false;
}

#[\ReturnTypeWillChange]
public function next()
{
$this->recordIndex++;
Expand All @@ -131,6 +133,7 @@ public function next()
}
}

#[\ReturnTypeWillChange]
public function key()
{
if ($logFile = $this->logFileIterator->current()) {
Expand All @@ -140,17 +143,20 @@ public function key()
return null;
}

#[\ReturnTypeWillChange]
public function valid()
{
return isset($this->records[$this->recordIndex]);
}

#[\ReturnTypeWillChange]
public function rewind()
{
$this->logFileIterator->rewind();
$this->loadRecordsFromCurrentLogFile();
}

#[\ReturnTypeWillChange]
public function getInnerIterator()
{
return $this->logFileIterator;
Expand Down
3 changes: 1 addition & 2 deletions src/Crypto/MetadataEnvelope.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use \IteratorAggregate;
use \InvalidArgumentException;
use \JsonSerializable;
use \ReturnTypeWillChange;

/**
* Stores encryption metadata for reading and writing.
Expand Down Expand Up @@ -50,7 +49,7 @@ public function offsetSet($name, $value)
$this->data[$name] = $value;
}

#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->data;
Expand Down
3 changes: 1 addition & 2 deletions src/DynamoDb/BinaryValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Aws\DynamoDb;

use GuzzleHttp\Psr7;
use \ReturnTypeWillChange;

/**
* Special object to represent a DynamoDB binary (B) value.
Expand All @@ -25,7 +24,7 @@ public function __construct($value)
$this->value = (string) $value;
}

#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->value;
Expand Down
4 changes: 1 addition & 3 deletions src/DynamoDb/NumberValue.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace Aws\DynamoDb;

use \ReturnTypeWillChange;

/**
* Special object to represent a DynamoDB Number (N) value.
*/
Expand All @@ -19,7 +17,7 @@ public function __construct($value)
$this->value = (string) $value;
}

#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->value;
Expand Down
14 changes: 6 additions & 8 deletions src/DynamoDb/SessionHandler.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace Aws\DynamoDb;

use \ReturnTypeWillChange;

/**
* Provides an interface for using Amazon DynamoDB as a session store by hooking
* into PHP's session handler hooks. Once registered, You may use the native
Expand Down Expand Up @@ -103,7 +101,7 @@ public function register()
*
* @return bool Whether or not the operation succeeded.
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
{
$this->savePath = $savePath;
Expand All @@ -117,7 +115,7 @@ public function open($savePath, $sessionName)
*
* @return bool Success
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function close()
{
$id = session_id();
Expand All @@ -138,7 +136,7 @@ public function close()
*
* @return string Session data.
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function read($id)
{
$this->openSessionId = $id;
Expand Down Expand Up @@ -172,7 +170,7 @@ public function read($id)
*
* @return bool Whether or not the operation succeeded.
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function write($id, $data)
{
$changed = $id !== $this->openSessionId
Expand All @@ -193,7 +191,7 @@ public function write($id, $data)
*
* @return bool Whether or not the operation succeeded.
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function destroy($id)
{
$this->openSessionId = $id;
Expand All @@ -213,7 +211,7 @@ public function destroy($id)
* @return bool Whether or not the operation succeeded.
* @codeCoverageIgnore
*/
#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function gc($maxLifetime)
{
// Garbage collection for a DynamoDB table must be triggered manually.
Expand Down
6 changes: 3 additions & 3 deletions src/DynamoDb/SetValue.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php
namespace Aws\DynamoDb;

use \ReturnTypeWillChange;

/**
* Special object to represent a DynamoDB set (SS/NS/BS) value.
*/
Expand All @@ -29,17 +27,19 @@ public function toArray()
return $this->values;
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->values);
}

#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->values);
}

#[ReturnTypeWillChange]
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->toArray();
Expand Down
1 change: 1 addition & 0 deletions src/HandlerList.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ public function resolve()
return $prev;
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->steps[self::INIT])
Expand Down
6 changes: 6 additions & 0 deletions src/HasDataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ trait HasDataTrait
/** @var array */
private $data = [];

#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->data);
Expand All @@ -23,6 +24,7 @@ public function getIterator()
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function & offsetGet($offset)
{
if (isset($this->data[$offset])) {
Expand All @@ -33,16 +35,19 @@ public function & offsetGet($offset)
return $value;
}

#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}

#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
unset($this->data[$offset]);
Expand All @@ -53,6 +58,7 @@ public function toArray()
return $this->data;
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->data);
Expand Down
2 changes: 2 additions & 0 deletions src/History.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ public function __construct($maxEntries = 10)
$this->maxEntries = $maxEntries;
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->entries);
}

#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator(array_values($this->entries));
Expand Down
1 change: 1 addition & 0 deletions src/LruArrayCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function remove($key)
unset($this->items[$key]);
}

#[\ReturnTypeWillChange]
public function count()
{
return count($this->items);
Expand Down
1 change: 1 addition & 0 deletions src/MockHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function getLastCommand()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function count()
{
return count($this->queue);
Expand Down