Fix PHP 8.1 deprecations

This commit is contained in:
Adrien Loison committed 2022-01-13 23:04:26 +01:00
1 parent 27c6845b4b
commit e75f6f7301
5 files changed
+29 -29

No files matched your search

+8 -8
View File
@@ -84,7 +84,7 @@ class RowIterator implements IteratorInterface
*
* @return void
*/
public function rewind()
public function rewind() : void
{
$this->rewindAndSkipBom();
@@ -114,7 +114,7 @@ class RowIterator implements IteratorInterface
*
* @return bool
*/
public function valid()
public function valid() : bool
{
return ($this->filePointer && !$this->hasReachedEndOfFile);
}
@@ -126,7 +126,7 @@ class RowIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\EncodingConversionException If unable to convert data to UTF-8
* @return void
*/
public function next()
public function next() : void
{
$this->hasReachedEndOfFile = $this->globalFunctionsHelper->feof($this->filePointer);
@@ -146,8 +146,8 @@ class RowIterator implements IteratorInterface
} while ($this->shouldReadNextRow($rowData));
if ($rowData !== false) {
// str_replace will replace NULL values by empty strings
$rowDataBufferAsArray = \str_replace(null, null, $rowData);
// array_map will replace NULL values by empty strings
$rowDataBufferAsArray = array_map(function ($value) { return (string) $value; }, $rowData);
$this->rowBuffer = $this->entityFactory->createRowFromArray($rowDataBufferAsArray);
$this->numReadRows++;
} else {
@@ -224,7 +224,7 @@ class RowIterator implements IteratorInterface
*
* @return Row|null
*/
public function current()
public function current() : ?Row
{
return $this->rowBuffer;
}
@@ -235,7 +235,7 @@ class RowIterator implements IteratorInterface
*
* @return int
*/
public function key()
public function key() : int
{
return $this->numReadRows;
}
@@ -245,7 +245,7 @@ class RowIterator implements IteratorInterface
*
* @return void
*/
public function end()
public function end() : void
{
// do nothing
}