Skip to content

Commit 192d4a3

Browse files
committed
Resolve Phpstan missingType.generics
Doc-block changes only; no change to executable code.
1 parent 6be8be8 commit 192d4a3

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

phpstan.neon.dist

-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ parameters:
2727
- '~^Parameter \#2 .* of static method PHPUnit\\Framework\\Assert\:\:assert\w+\(\) expects .*, .* given\.$~'
2828
- '~^Variable \$helper might not be defined\.$~'
2929
- identifier: missingType.iterableValue
30-
- identifier: missingType.generics

src/PhpSpreadsheet/Worksheet/AutoFilter.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
99
use PhpOffice\PhpSpreadsheet\Calculation\Internal\WildcardMatch;
1010
use PhpOffice\PhpSpreadsheet\Cell\AddressRange;
11+
use PhpOffice\PhpSpreadsheet\Cell\CellAddress;
12+
use PhpOffice\PhpSpreadsheet\Cell\CellRange;
1113
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
1214
use PhpOffice\PhpSpreadsheet\Exception;
1315
use PhpOffice\PhpSpreadsheet\Shared\Date;
@@ -48,7 +50,7 @@ public function setEvaluated(bool $value): void
4850
/**
4951
* Create a new AutoFilter.
5052
*
51-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
53+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
5254
* A simple string containing a Cell range like 'A1:E10' is permitted
5355
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
5456
* or an AddressRange object.
@@ -100,7 +102,7 @@ public function getRange(): string
100102
/**
101103
* Set AutoFilter Cell Range.
102104
*
103-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
105+
* @param AddressRange<CellRange>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
104106
* A simple string containing a Cell range like 'A1:E10' or a Cell address like 'A1' is permitted
105107
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
106108
* or an AddressRange object.

src/PhpSpreadsheet/Worksheet/Table.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace PhpOffice\PhpSpreadsheet\Worksheet;
44

55
use PhpOffice\PhpSpreadsheet\Cell\AddressRange;
6+
use PhpOffice\PhpSpreadsheet\Cell\CellAddress;
67
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
78
use PhpOffice\PhpSpreadsheet\Cell\DataType;
89
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
@@ -63,7 +64,7 @@ class Table implements Stringable
6364
/**
6465
* Create a new Table.
6566
*
66-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
67+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
6768
* A simple string containing a Cell range like 'A1:E10' is permitted
6869
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
6970
* or an AddressRange object.
@@ -267,7 +268,7 @@ public function getRange(): string
267268
/**
268269
* Set Table Cell Range.
269270
*
270-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
271+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range
271272
* A simple string containing a Cell range like 'A1:E10' is permitted
272273
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
273274
* or an AddressRange object.

src/PhpSpreadsheet/Worksheet/Validations.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static function validateCellAddress(null|CellAddress|string|array $cellAd
3636
/**
3737
* Validate a cell address or cell range.
3838
*
39-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12';
39+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12';
4040
* or as an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 12]),
4141
* or as a CellAddress or AddressRange object.
4242
*/
@@ -59,7 +59,7 @@ public static function validateCellOrCellRange(AddressRange|CellAddress|int|stri
5959
/**
6060
* Validate a cell range.
6161
*
62-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12';
62+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $cellRange Coordinate of the cells as a string, eg: 'C5:F12';
6363
* or as an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 12]),
6464
* or as an AddressRange object.
6565
*/

src/PhpSpreadsheet/Worksheet/Worksheet.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ public function getStyles(): array
13841384
/**
13851385
* Get style for cell.
13861386
*
1387-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $cellCoordinate
1387+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $cellCoordinate
13881388
* A simple string containing a cell address like 'A1' or a cell range like 'A1:E10'
13891389
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
13901390
* or a CellAddress or AddressRange object.
@@ -1688,7 +1688,7 @@ public function getColumnBreaks(): array
16881688
/**
16891689
* Set merge on a cell range.
16901690
*
1691-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10'
1691+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10'
16921692
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
16931693
* or an AddressRange.
16941694
* @param string $behaviour How the merged cells should behave.
@@ -1813,7 +1813,7 @@ public function mergeCellBehaviour(Cell $cell, string $upperLeft, string $behavi
18131813
/**
18141814
* Remove merge on a cell range.
18151815
*
1816-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10'
1816+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10'
18171817
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
18181818
* or an AddressRange.
18191819
*
@@ -1864,7 +1864,7 @@ public function setMergeCells(array $mergeCells): static
18641864
/**
18651865
* Set protection on a cell or cell range.
18661866
*
1867-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10'
1867+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10'
18681868
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
18691869
* or a CellAddress or AddressRange object.
18701870
* @param string $password Password to unlock the protection
@@ -1887,7 +1887,7 @@ public function protectCells(AddressRange|CellAddress|int|string|array $range, s
18871887
/**
18881888
* Remove protection on a cell or cell range.
18891889
*
1890-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10'
1890+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10'
18911891
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
18921892
* or a CellAddress or AddressRange object.
18931893
*
@@ -1945,7 +1945,7 @@ public function getAutoFilter(): AutoFilter
19451945
/**
19461946
* Set AutoFilter.
19471947
*
1948-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|AutoFilter|string $autoFilterOrRange
1948+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|AutoFilter|string $autoFilterOrRange
19491949
* A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility
19501950
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
19511951
* or an AddressRange.
@@ -2691,7 +2691,7 @@ public function setSelectedCell(string $coordinate): static
26912691
/**
26922692
* Select a range of cells.
26932693
*
2694-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $coordinate A simple string containing a Cell range like 'A1:E10'
2694+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $coordinate A simple string containing a Cell range like 'A1:E10'
26952695
* or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]),
26962696
* or a CellAddress or AddressRange object.
26972697
*

tests/PhpSpreadsheetTests/Worksheet/Table/TableTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function testGetRange(): void
156156
}
157157

158158
/**
159-
* @param AddressRange|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $fullRange
159+
* @param AddressRange<CellAddress>|array{0: int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $fullRange
160160
*/
161161
public function xtestSetRangeValidRange(string|array|AddressRange $fullRange, string $actualRange): void
162162
{

0 commit comments

Comments
 (0)