Declare key of generic ArrayObject

This commit is contained in:
Adrien Crivelli 2021-11-10 10:12:05 +09:00
parent 8978e48914
commit 5a704158e1
9 changed files with 58 additions and 53 deletions

View File

@ -6225,11 +6225,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php
-
message: "#^Class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator implements generic interface Iterator but does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/CellIterator.php
- -
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:adjustForExistingOnlyRange\\(\\) has no return type specified\\.$#" message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:adjustForExistingOnlyRange\\(\\) has no return type specified\\.$#"
count: 1 count: 1
@ -6240,16 +6235,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Column.php path: src/PhpSpreadsheet/Worksheet/Column.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php
-
message: "#^Class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\ColumnIterator implements generic interface Iterator but does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/ColumnIterator.php
- -
message: "#^Cannot use array destructuring on array\\|false\\.$#" message: "#^Cannot use array destructuring on array\\|false\\.$#"
count: 2 count: 2
@ -6260,11 +6245,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php path: src/PhpSpreadsheet/Worksheet/Drawing/Shadow.php
-
message: "#^Class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Iterator implements generic interface Iterator but does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Iterator.php
- -
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:getPrintArea\\(\\) should return string but returns string\\|null\\.$#" message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\PageSetup\\:\\:getPrintArea\\(\\) should return string but returns string\\|null\\.$#"
count: 1 count: 1
@ -6295,16 +6275,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Row.php path: src/PhpSpreadsheet/Worksheet/Row.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:\\$worksheet \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/RowCellIterator.php
-
message: "#^Class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\RowIterator implements generic interface Iterator but does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/RowIterator.php
- -
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\SheetView\\:\\:\\$sheetViewTypes has no type specified\\.$#" message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\SheetView\\:\\:\\$sheetViewTypes has no type specified\\.$#"
count: 1 count: 1
@ -6376,12 +6346,7 @@ parameters:
path: src/PhpSpreadsheet/Worksheet/Worksheet.php path: src/PhpSpreadsheet/Worksheet/Worksheet.php
- -
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartCollection\\(\\) return type with generic class ArrayObject does not specify its types\\: TKey, TValue$#" message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartByName\\(\\) should return PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|false but returns PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getDrawingCollection\\(\\) return type with generic class ArrayObject does not specify its types\\: TKey, TValue$#"
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php path: src/PhpSpreadsheet/Worksheet/Worksheet.php
@ -6395,6 +6360,11 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Parameter \\#1 \\$input of function array_splice expects array, ArrayObject\\<int, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\> given\\.$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
- -
message: "#^Parameter \\#1 \\$range of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter constructor expects string, null given\\.$#" message: "#^Parameter \\#1 \\$range of class PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\AutoFilter constructor expects string, null given\\.$#"
count: 1 count: 1
@ -6440,16 +6410,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$chartCollection with generic class ArrayObject does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$drawingCollection with generic class ArrayObject does not specify its types\\: TKey, TValue$#"
count: 1
path: src/PhpSpreadsheet/Worksheet/Worksheet.php
- -
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|null\\.$#" message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:\\$parent \\(PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\|null\\.$#"
count: 1 count: 1
@ -8925,6 +8885,21 @@ parameters:
count: 1 count: 1
path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php path: tests/PhpSpreadsheetTests/Reader/Xlsx/AutoFilterTest.php
-
message: "#^Cannot call method getTitle\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#"
count: 5
path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php
-
message: "#^Cannot call method getXAxisLabel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#"
count: 5
path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php
-
message: "#^Cannot call method getYAxisLabel\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#"
count: 5
path: tests/PhpSpreadsheetTests/Reader/Xlsx/ChartsTitleTest.php
- -
message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#" message: "#^Cannot call method getColor\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\|null\\.$#"
count: 5 count: 5
@ -8970,6 +8945,11 @@ parameters:
count: 2 count: 2
path: tests/PhpSpreadsheetTests/Reader/Xlsx/PropertiesTest.php path: tests/PhpSpreadsheetTests/Reader/Xlsx/PropertiesTest.php
-
message: "#^Cannot call method getPlotArea\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Reader/Xlsx/SheetsXlsxChartTest.php
- -
message: "#^Expression in empty\\(\\) is not falsy\\.$#" message: "#^Expression in empty\\(\\) is not falsy\\.$#"
count: 1 count: 1
@ -9275,3 +9255,8 @@ parameters:
count: 2 count: 2
path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php path: tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php
-
message: "#^Cannot call method getExtension\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\|null\\.$#"
count: 2
path: tests/PhpSpreadsheetTests/Writer/Xlsx/WmfTest.php

View File

@ -3,7 +3,12 @@
namespace PhpOffice\PhpSpreadsheet\Worksheet; namespace PhpOffice\PhpSpreadsheet\Worksheet;
use Iterator; use Iterator;
use PhpOffice\PhpSpreadsheet\Cell\Cell;
/**
* @template TKey
* @implements Iterator<TKey, Cell>
*/
abstract class CellIterator implements Iterator abstract class CellIterator implements Iterator
{ {
/** /**

View File

@ -6,6 +6,9 @@ use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
/**
* @extends CellIterator<int>
*/
class ColumnCellIterator extends CellIterator class ColumnCellIterator extends CellIterator
{ {
/** /**
@ -44,7 +47,7 @@ class ColumnCellIterator extends CellIterator
* @param int $startRow The row number at which to start iterating * @param int $startRow The row number at which to start iterating
* @param int $endRow Optionally, the row number at which to stop iterating * @param int $endRow Optionally, the row number at which to stop iterating
*/ */
public function __construct(?Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null) public function __construct(Worksheet $subject, $columnIndex = 'A', $startRow = 1, $endRow = null)
{ {
// Set subject // Set subject
$this->worksheet = $subject; $this->worksheet = $subject;

View File

@ -7,6 +7,9 @@ use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Exception; use PhpOffice\PhpSpreadsheet\Exception;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
/**
* @implements Iterator<string, Column>
*/
class ColumnIterator implements Iterator class ColumnIterator implements Iterator
{ {
/** /**

View File

@ -4,6 +4,9 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet;
use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Spreadsheet;
/**
* @implements \Iterator<int, Worksheet>
*/
class Iterator implements \Iterator class Iterator implements \Iterator
{ {
/** /**

View File

@ -6,6 +6,9 @@ use PhpOffice\PhpSpreadsheet\Cell\Cell;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate; use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
/**
* @extends CellIterator<string>
*/
class RowCellIterator extends CellIterator class RowCellIterator extends CellIterator
{ {
/** /**
@ -44,7 +47,7 @@ class RowCellIterator extends CellIterator
* @param string $startColumn The column address at which to start iterating * @param string $startColumn The column address at which to start iterating
* @param string $endColumn Optionally, the column address at which to stop iterating * @param string $endColumn Optionally, the column address at which to stop iterating
*/ */
public function __construct(?Worksheet $worksheet = null, $rowIndex = 1, $startColumn = 'A', $endColumn = null) public function __construct(Worksheet $worksheet, $rowIndex = 1, $startColumn = 'A', $endColumn = null)
{ {
// Set subject and row index // Set subject and row index
$this->worksheet = $worksheet; $this->worksheet = $worksheet;

View File

@ -5,6 +5,9 @@ namespace PhpOffice\PhpSpreadsheet\Worksheet;
use Iterator; use Iterator;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException; use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
/**
* @implements Iterator<int, Row>
*/
class RowIterator implements Iterator class RowIterator implements Iterator
{ {
/** /**

View File

@ -96,14 +96,14 @@ class Worksheet implements IComparable
/** /**
* Collection of drawings. * Collection of drawings.
* *
* @var ArrayObject<BaseDrawing> * @var ArrayObject<int, BaseDrawing>
*/ */
private $drawingCollection; private $drawingCollection;
/** /**
* Collection of Chart objects. * Collection of Chart objects.
* *
* @var ArrayObject<Chart> * @var ArrayObject<int, Chart>
*/ */
private $chartCollection; private $chartCollection;
@ -537,7 +537,7 @@ class Worksheet implements IComparable
/** /**
* Get collection of drawings. * Get collection of drawings.
* *
* @return ArrayObject<BaseDrawing> * @return ArrayObject<int, BaseDrawing>
*/ */
public function getDrawingCollection() public function getDrawingCollection()
{ {
@ -547,7 +547,7 @@ class Worksheet implements IComparable
/** /**
* Get collection of charts. * Get collection of charts.
* *
* @return ArrayObject<Chart> * @return ArrayObject<int, Chart>
*/ */
public function getChartCollection() public function getChartCollection()
{ {

View File

@ -465,7 +465,7 @@ class Drawing extends WriterPart
/** /**
* Get an array of all drawings. * Get an array of all drawings.
* *
* @return \PhpOffice\PhpSpreadsheet\Worksheet\Drawing[] All drawings in PhpSpreadsheet * @return BaseDrawing[] All drawings in PhpSpreadsheet
*/ */
public function allDrawings(Spreadsheet $spreadsheet) public function allDrawings(Spreadsheet $spreadsheet)
{ {