Skip to content

Commit

Permalink
fix: Improve PHP 8.1 compatibility by disabling deprecation notices (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Apr 20, 2022
1 parent 59ff4e9 commit 6702b54
Show file tree
Hide file tree
Showing 23 changed files with 57 additions and 0 deletions.
1 change: 1 addition & 0 deletions BigQuery/src/QueryResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ public function job()
* query completion has been exceeded.
* @throws GoogleException Thrown in the case of a malformed response.
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->rows();
Expand Down
1 change: 1 addition & 0 deletions Bigtable/src/ChunkFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ private function cellInProgress(CellChunk $chunk)
* @return \Generator
* @throws BigtableDataOperationException Thrown in the case of a malformed response.
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->readAll();
Expand Down
1 change: 1 addition & 0 deletions Bigtable/src/ResumableStream.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function readAll()
* @return \Generator
* @throws ApiException Thrown in the case of a malformed response.
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->readAll();
Expand Down
5 changes: 5 additions & 0 deletions Core/src/Iterator/ItemIteratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public function iterateByPage()
*
* @return null
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->pageIndex = 0;
Expand All @@ -86,6 +87,7 @@ public function rewind()
*
* @return mixed
*/
#[\ReturnTypeWillChange]
public function current()
{
$page = $this->pageIterator->current();
Expand All @@ -100,6 +102,7 @@ public function current()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -110,6 +113,7 @@ public function key()
*
* @return null
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->pageIndex++;
Expand All @@ -126,6 +130,7 @@ public function next()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
$page = $this->pageIterator->current();
Expand Down
5 changes: 5 additions & 0 deletions Core/src/Iterator/PageIteratorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ public function nextResultToken()
*
* @return null
*/
#[\ReturnTypeWillChange]
public function rewind()
{
$this->itemCount = 0;
Expand All @@ -169,6 +170,7 @@ public function rewind()
*
* @return array|null
*/
#[\ReturnTypeWillChange]
public function current()
{
if ($this->page === null) {
Expand All @@ -189,6 +191,7 @@ public function current()
*
* @return int
*/
#[\ReturnTypeWillChange]
public function key()
{
return $this->position;
Expand All @@ -199,6 +202,7 @@ public function key()
*
* @return null
*/
#[\ReturnTypeWillChange]
public function next()
{
$this->position++;
Expand All @@ -212,6 +216,7 @@ public function next()
*
* @return bool
*/
#[\ReturnTypeWillChange]
public function valid()
{
if (!$this->page && $this->position) {
Expand Down
1 change: 1 addition & 0 deletions Core/src/Testing/FileListFilterIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function __construct(
* @experimental
* @internal
*/
#[\ReturnTypeWillChange]
public function accept()
{
/** @var \SplFileInfo */
Expand Down
1 change: 1 addition & 0 deletions Core/src/Testing/Snippet/Coverage/ExcludeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function __construct(Iterator $iterator, array $excludeDirs)
/**
* @return bool Determines whether to accept or exclude a path
*/
#[\ReturnTypeWillChange]
public function accept()
{
// Accept the current item if we can recurse into it
Expand Down
1 change: 1 addition & 0 deletions Core/src/Testing/Snippet/Parser/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public function regexReplace($pattern, $new)
*
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->config;
Expand Down
6 changes: 6 additions & 0 deletions Datastore/src/DatastoreSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ public function __construct(
* used here. It will use this value as the Datastore kind.
* @return bool
*/
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
{
$this->kind = $sessionName;
Expand All @@ -206,6 +207,7 @@ public function open($savePath, $sessionName)
/**
* Just return true for this implementation.
*/
#[\ReturnTypeWillChange]
public function close()
{
return true;
Expand All @@ -214,6 +216,7 @@ public function close()
/**
* Read the session data from Cloud Datastore.
*/
#[\ReturnTypeWillChange]
public function read($id)
{
try {
Expand Down Expand Up @@ -243,6 +246,7 @@ public function read($id)
* @param string $data The session data to write to the {@see \Google\Cloud\Datastore\Entity}.
* @return bool
*/
#[\ReturnTypeWillChange]
public function write($id, $data)
{
try {
Expand Down Expand Up @@ -274,6 +278,7 @@ public function write($id, $data)
/**
* Delete the session data from Cloud Datastore.
*/
#[\ReturnTypeWillChange]
public function destroy($id)
{
try {
Expand All @@ -297,6 +302,7 @@ public function destroy($id)
/**
* Delete the old session data from Cloud Datastore.
*/
#[\ReturnTypeWillChange]
public function gc($maxlifetime)
{
if ($this->gcLimit === 0) {
Expand Down
4 changes: 4 additions & 0 deletions Datastore/src/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ class Entity implements ArrayAccess, EntityInterface
* @return void
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetSet($key, $val)
{
$this->entity[$key] = $val;
Expand All @@ -123,6 +124,7 @@ public function offsetSet($key, $val)
* @return bool
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetExists($key)
{
return isset($this->entity[$key]);
Expand All @@ -133,6 +135,7 @@ public function offsetExists($key)
* @return void
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
unset($this->entity[$key]);
Expand All @@ -143,6 +146,7 @@ public function offsetUnset($key)
* @return mixed
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetGet($key)
{
return isset($this->entity[$key])
Expand Down
1 change: 1 addition & 0 deletions Datastore/src/EntityPageIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function moreResultsType()
*
* @return array|null
*/
#[\ReturnTypeWillChange]
public function current()
{
if (!$this->page) {
Expand Down
1 change: 1 addition & 0 deletions Datastore/src/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ public function keyObject()
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->keyObject();
Expand Down
1 change: 1 addition & 0 deletions Datastore/src/Query/GqlQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public function start($cursor)
* @access private
* @return array
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->queryObject();
Expand Down
1 change: 1 addition & 0 deletions Datastore/src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ public function queryKey()
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return $this->queryObject();
Expand Down
4 changes: 4 additions & 0 deletions Datastore/tests/Unit/SampleEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,25 @@ public static function mappings()
];
}

#[\ReturnTypeWillChange]
public function offsetSet($key, $val)
{
$this->entity[$key] = $val;
}

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

#[\ReturnTypeWillChange]
public function offsetUnset($key)
{
unset($this->entity[$key]);
}

#[\ReturnTypeWillChange]
public function offsetGet($key)
{
return isset($this->entity[$key])
Expand Down
1 change: 1 addition & 0 deletions Debugger/src/MatchingFileIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function __construct($searchPath, $file)
* @access private
* @return boolean
*/
#[\ReturnTypeWillChange]
public function accept()
{
$candidate = $this->getInnerIterator()->current();
Expand Down
4 changes: 4 additions & 0 deletions Firestore/src/DocumentSnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ public function get($fieldPath)
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetSet($offset, $value)
{
throw new \BadMethodCallException('DocumentSnapshots are read-only.');
Expand All @@ -318,6 +319,7 @@ public function offsetSet($offset, $value)
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetExists($offset)
{
return array_key_exists($offset, $this->data);
Expand All @@ -326,6 +328,7 @@ public function offsetExists($offset)
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetUnset($offset)
{
throw new \BadMethodCallException('DocumentSnapshots are read-only.');
Expand All @@ -334,6 +337,7 @@ public function offsetUnset($offset)
/**
* @access private
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
if (!$this->offsetExists($offset)) {
Expand Down
6 changes: 6 additions & 0 deletions Firestore/src/FirestoreSessionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ public function __construct(
* used in the Firestore collection ID.
* @return bool
*/
#[\ReturnTypeWillChange]
public function open($savePath, $sessionName)
{
$this->savePath = $savePath;
Expand Down Expand Up @@ -241,6 +242,7 @@ public function open($savePath, $sessionName)
/**
* Close the transaction and commit any changes.
*/
#[\ReturnTypeWillChange]
public function close()
{
if (is_null($this->transaction)) {
Expand All @@ -264,6 +266,7 @@ public function close()
* @param string $id Identifier used for the session.
* @return string
*/
#[\ReturnTypeWillChange]
public function read($id)
{
$this->id = $id;
Expand Down Expand Up @@ -298,6 +301,7 @@ public function read($id)
* @param string $data The session data to write to the Firestore document.
* @return bool
*/
#[\ReturnTypeWillChange]
public function write($id, $data)
{
$docRef = $this->getDocumentReference(
Expand All @@ -320,6 +324,7 @@ public function write($id, $data)
* @param string $id Identifier used for the session
* @return bool
*/
#[\ReturnTypeWillChange]
public function destroy($id)
{
$docRef = $this->getDocumentReference(
Expand All @@ -340,6 +345,7 @@ public function destroy($id)
* in seconds.
* @return int|bool
*/
#[\ReturnTypeWillChange]
public function gc($maxlifetime)
{
if (0 === $this->options['gcLimit']) {
Expand Down
1 change: 1 addition & 0 deletions Firestore/src/QuerySnapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public function rows()
* @access private
* @return \ArrayIterator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return new \ArrayIterator($this->rows);
Expand Down
1 change: 1 addition & 0 deletions Spanner/src/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ public function transaction()
* @access private
* @return \Generator
*/
#[\ReturnTypeWillChange]
public function getIterator()
{
return $this->rows();
Expand Down

0 comments on commit 6702b54

Please sign in to comment.