Merge 08a76b84a3b0e2565ab7d1e1c961cfe285df1d56 into 84596668410bea89d21aa9867b91e1550e359329

This commit is contained in:
Fabian Wiget 2022-05-26 15:55:27 +02:00 committed by GitHub
commit 17027afe77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 19 deletions

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
* @return void
*/
public function rewind()
public function rewind() : void
{
$this->xmlReader->close();
@ -103,7 +103,7 @@ class SheetIterator implements IteratorInterface
*
* @return array Associative array [STYLE_NAME] => [IS_SHEET_VISIBLE]
*/
private function readSheetsVisibility()
private function readSheetsVisibility() : array
{
$sheetsVisibility = [];
@ -133,7 +133,7 @@ class SheetIterator implements IteratorInterface
*
* @return bool
*/
public function valid()
public function valid() : bool
{
return $this->hasFoundSheet;
}
@ -144,7 +144,7 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function next()
public function next() : void
{
$this->hasFoundSheet = $this->xmlReader->readUntilNodeFound(self::XML_NODE_TABLE);
@ -157,9 +157,9 @@ class SheetIterator implements IteratorInterface
* Return the current element
* @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);
$sheetName = $this->escaper->unescape($escapedSheetName);
@ -187,7 +187,7 @@ class SheetIterator implements IteratorInterface
* @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
*/
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
// or if no information about the active sheet was found, it defaults to the first sheet.
@ -203,7 +203,7 @@ class SheetIterator implements IteratorInterface
* @param string $sheetStyleName Name of the sheet style
* @return bool Whether the current sheet is visible
*/
private function isSheetVisible($sheetStyleName)
private function isSheetVisible($sheetStyleName) : bool
{
return isset($this->sheetsVisibility[$sheetStyleName]) ?
$this->sheetsVisibility[$sheetStyleName] :
@ -216,7 +216,7 @@ class SheetIterator implements IteratorInterface
*
* @return int
*/
public function key()
public function key() : int
{
return $this->currentSheetIndex + 1;
}
@ -226,7 +226,7 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function end()
public function end() : void
{
$this->xmlReader->close();
}

View File

@ -83,7 +83,7 @@ class XMLReader extends \XMLReader
* @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred
* @return bool TRUE on success or FALSE on failure
*/
public function read()
public function read() : bool
{
$this->useXMLInternalErrors();
@ -119,7 +119,7 @@ class XMLReader extends \XMLReader
* @throws \Box\Spout\Reader\Exception\XMLProcessingException If an error/warning occurred
* @return bool TRUE on success or FALSE on failure
*/
public function next($localName = null)
public function next($localName = null) : bool
{
$this->useXMLInternalErrors();

View File

@ -38,7 +38,7 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function rewind()
public function rewind() : void
{
$this->currentSheetIndex = 0;
}
@ -49,7 +49,7 @@ class SheetIterator implements IteratorInterface
*
* @return bool
*/
public function valid()
public function valid() : bool
{
return ($this->currentSheetIndex < \count($this->sheets));
}
@ -60,7 +60,7 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function next()
public function next() : void
{
// Using isset here because it is way faster than array_key_exists...
if (isset($this->sheets[$this->currentSheetIndex])) {
@ -75,9 +75,9 @@ class SheetIterator implements IteratorInterface
* Return the current element
* @see http://php.net/manual/en/iterator.current.php
*
* @return \Box\Spout\Reader\XLSX\Sheet
* @return Sheet
*/
public function current()
public function current() : Sheet
{
return $this->sheets[$this->currentSheetIndex];
}
@ -88,7 +88,7 @@ class SheetIterator implements IteratorInterface
*
* @return int
*/
public function key()
public function key() : int
{
return $this->currentSheetIndex + 1;
}
@ -98,7 +98,7 @@ class SheetIterator implements IteratorInterface
*
* @return void
*/
public function end()
public function end() : void
{
// make sure we are not leaking memory in case the iteration stopped before the end
foreach ($this->sheets as $sheet) {