Stronger typing for newly introduced methods

This commit is contained in:
Adrien Crivelli
2023-09-12 11:24:02 +08:00
parent 627f76a803
commit 1b27d9c95d
3 changed files with 4 additions and 20 deletions
+2 -10
View File
@@ -204,12 +204,8 @@ abstract class BaseReader implements IReader
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
*
* @param string $filename
*
* @return array
*/
public function listWorksheetInfo($filename)
public function listWorksheetInfo(string $filename): array
{
throw new PhpSpreadsheetException('Reader classes must implement their own listWorksheetInfo() method');
}
@@ -219,12 +215,8 @@ abstract class BaseReader implements IReader
* possibly without parsing the whole file to a Spreadsheet object.
* Readers will often have a more efficient method with which
* they can override this method.
*
* @param string $filename
*
* @return array
*/
public function listWorksheetNames($filename)
public function listWorksheetNames(string $filename): array
{
$returnArray = [];
$info = $this->listWorksheetInfo($filename);
+1 -5
View File
@@ -216,12 +216,8 @@ class Csv extends BaseReader
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
*
* @param string $filename
*
* @return array
*/
public function listWorksheetInfo($filename)
public function listWorksheetInfo(string $filename): array
{
// Open file
$this->openFileOrMemory($filename);
+1 -5
View File
@@ -1167,12 +1167,8 @@ class Html extends BaseReader
/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns).
*
* @param string $filename
*
* @return array
*/
public function listWorksheetInfo($filename)
public function listWorksheetInfo(string $filename): array
{
$info = [];
$spreadsheet = new Spreadsheet();