Fix incompatible return types in ODS\SheetIterator

This commit is contained in:
Fabian Wiget 2022-01-06 12:12:18 +01:00
parent cc42c1d29f
commit e22369596f

View File

@ -79,7 +79,7 @@ class SheetIterator implements IteratorInterface
* @throws \Box\Spout\Common\Exception\IOException If unable to open the XML file containing sheets' data * @throws \Box\Spout\Common\Exception\IOException If unable to open the XML file containing sheets' data
* @return void * @return void
*/ */
public function rewind() public function rewind() : void
{ {
$this->xmlReader->close(); $this->xmlReader->close();
@ -103,7 +103,7 @@ class SheetIterator implements IteratorInterface
* *
* @return array Associative array [STYLE_NAME] => [IS_SHEET_VISIBLE] * @return array Associative array [STYLE_NAME] => [IS_SHEET_VISIBLE]
*/ */
private function readSheetsVisibility() private function readSheetsVisibility() : array
{ {
$sheetsVisibility = []; $sheetsVisibility = [];
@ -132,7 +132,7 @@ class SheetIterator implements IteratorInterface
* *
* @return bool * @return bool
*/ */
public function valid() public function valid() : bool
{ {
return $this->hasFoundSheet; return $this->hasFoundSheet;
} }
@ -143,7 +143,7 @@ class SheetIterator implements IteratorInterface
* *
* @return void * @return void
*/ */
public function next() public function next() : void
{ {
$this->hasFoundSheet = $this->xmlReader->readUntilNodeFound(self::XML_NODE_TABLE); $this->hasFoundSheet = $this->xmlReader->readUntilNodeFound(self::XML_NODE_TABLE);
@ -156,9 +156,9 @@ class SheetIterator implements IteratorInterface
* Return the current element * Return the current element
* @see http://php.net/manual/en/iterator.current.php * @see http://php.net/manual/en/iterator.current.php
* *
* @return \Box\Spout\Reader\ODS\Sheet * @return Sheet
*/ */
public function current() public function current() : Sheet
{ {
$escapedSheetName = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_TABLE_NAME); $escapedSheetName = $this->xmlReader->getAttribute(self::XML_ATTRIBUTE_TABLE_NAME);
$sheetName = $this->escaper->unescape($escapedSheetName); $sheetName = $this->escaper->unescape($escapedSheetName);
@ -186,7 +186,7 @@ class SheetIterator implements IteratorInterface
* @param string|null $activeSheetName Name of the sheet that was defined as active or NULL if none defined * @param string|null $activeSheetName Name of the sheet that was defined as active or NULL if none defined
* @return bool Whether the current sheet was defined as the active one * @return bool Whether the current sheet was defined as the active one
*/ */
private function isSheetActive($sheetName, $sheetIndex, $activeSheetName) private function isSheetActive($sheetName, $sheetIndex, $activeSheetName) : bool
{ {
// The given sheet is active if its name matches the defined active sheet's name // The given sheet is active if its name matches the defined active sheet's name
// or if no information about the active sheet was found, it defaults to the first sheet. // or if no information about the active sheet was found, it defaults to the first sheet.
@ -202,7 +202,7 @@ class SheetIterator implements IteratorInterface
* @param string $sheetStyleName Name of the sheet style * @param string $sheetStyleName Name of the sheet style
* @return bool Whether the current sheet is visible * @return bool Whether the current sheet is visible
*/ */
private function isSheetVisible($sheetStyleName) private function isSheetVisible($sheetStyleName) : bool
{ {
return isset($this->sheetsVisibility[$sheetStyleName]) ? return isset($this->sheetsVisibility[$sheetStyleName]) ?
$this->sheetsVisibility[$sheetStyleName] : $this->sheetsVisibility[$sheetStyleName] :
@ -215,7 +215,7 @@ class SheetIterator implements IteratorInterface
* *
* @return int * @return int
*/ */
public function key() public function key() : int
{ {
return $this->currentSheetIndex + 1; return $this->currentSheetIndex + 1;
} }
@ -225,7 +225,7 @@ class SheetIterator implements IteratorInterface
* *
* @return void * @return void
*/ */
public function end() public function end() : void
{ {
$this->xmlReader->close(); $this->xmlReader->close();
} }