Skip to content

Commit f46e3a1

Browse files
committed
Use native typing for objects that were already documented as such
1 parent 6cf20b0 commit f46e3a1

36 files changed

+54
-323
lines changed

phpstan-baseline.neon

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -7090,16 +7090,6 @@ parameters:
70907090
count: 1
70917091
path: src/PhpSpreadsheet/Writer/Xls/Workbook.php
70927092

7093-
-
7094-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$escher \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|null\\.$#"
7095-
count: 1
7096-
path: src/PhpSpreadsheet/Writer/Xls/Workbook.php
7097-
7098-
-
7099-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Workbook\\:\\:\\$escher \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\) in isset\\(\\) is not nullable\\.$#"
7100-
count: 1
7101-
path: src/PhpSpreadsheet/Writer/Xls/Workbook.php
7102-
71037093
-
71047094
message: "#^Cannot access offset 'comp' on array\\|false\\.$#"
71057095
count: 1
@@ -7255,16 +7245,6 @@ parameters:
72557245
count: 1
72567246
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
72577247

7258-
-
7259-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$escher \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\|null\\.$#"
7260-
count: 1
7261-
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
7262-
7263-
-
7264-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$escher \\(PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\) in isset\\(\\) is not nullable\\.$#"
7265-
count: 1
7266-
path: src/PhpSpreadsheet/Writer/Xls/Worksheet.php
7267-
72687248
-
72697249
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xls\\\\Worksheet\\:\\:\\$outlineBelow is never read, only written\\.$#"
72707250
count: 1
@@ -7325,11 +7305,6 @@ parameters:
73257305
count: 1
73267306
path: src/PhpSpreadsheet/Writer/Xlsx.php
73277307

7328-
-
7329-
message: "#^Argument of an invalid type array\\|string supplied for foreach, only iterables are supported\\.$#"
7330-
count: 1
7331-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7332-
73337308
-
73347309
message: "#^Cannot access offset int on mixed\\.$#"
73357310
count: 2
@@ -7351,12 +7326,7 @@ parameters:
73517326
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
73527327

73537328
-
7354-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:getChartType\\(\\) never returns string so it can be removed from the return type\\.$#"
7355-
count: 1
7356-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7357-
7358-
-
7359-
message: "#^Parameter \\#1 \\$plotSeriesValues of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeBubbles\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false given\\.$#"
7329+
message: "#^Parameter \\#1 \\$plotSeriesValues of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeBubbles\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues|null, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues\\|false given\\.$#"
73607330
count: 1
73617331
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
73627332

@@ -7400,16 +7370,6 @@ parameters:
74007370
count: 2
74017371
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
74027372

7403-
-
7404-
message: "#^Parameter \\#2 \\$xAxisLabel of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null given\\.$#"
7405-
count: 1
7406-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7407-
7408-
-
7409-
message: "#^Parameter \\#2 \\$yAxisLabel of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeValueAxis\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Title\\|null given\\.$#"
7410-
count: 2
7411-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7412-
74137373
-
74147374
message: "#^Parameter \\#3 \\$id1 of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Chart\\:\\:writeCategoryAxis\\(\\) expects string, int\\|string given\\.$#"
74157375
count: 1
@@ -7465,16 +7425,6 @@ parameters:
74657425
count: 1
74667426
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
74677427

7468-
-
7469-
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeries and null will always evaluate to false\\.$#"
7470-
count: 1
7471-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7472-
7473-
-
7474-
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\DataSeriesValues and null will always evaluate to false\\.$#"
7475-
count: 3
7476-
path: src/PhpSpreadsheet/Writer/Xlsx/Chart.php
7477-
74787428
-
74797429
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\PlotArea and null will always evaluate to false\\.$#"
74807430
count: 1
@@ -7545,16 +7495,6 @@ parameters:
75457495
count: 1
75467496
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
75477497

7548-
-
7549-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeDrawingHyperLink\\(\\) has parameter \\$i with no type specified\\.$#"
7550-
count: 1
7551-
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
7552-
7553-
-
7554-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeDrawingHyperLink\\(\\) has parameter \\$objWriter with no type specified\\.$#"
7555-
count: 1
7556-
path: src/PhpSpreadsheet/Writer/Xlsx/Rels.php
7557-
75587498
-
75597499
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$relationship with no type specified\\.$#"
75607500
count: 1

src/PhpSpreadsheet/Calculation/Calculation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4230,7 +4230,7 @@ private function internalParseFormula($formula, ?Cell $cell = null)
42304230
if (ctype_digit($val) && $val <= 1048576) {
42314231
// Row range
42324232
$stackItemType = 'Row Reference';
4233-
/** @var string */
4233+
/** @var int $valx */
42344234
$valx = $val;
42354235
$endRowColRef = ($refSheet !== null) ? $refSheet->getHighestDataColumn($valx) : 'XFD'; // Max 16,384 columns for Excel2007
42364236
$val = "{$rangeWS2}{$endRowColRef}{$val}";

src/PhpSpreadsheet/Cell/Cell.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Cell
7070
*
7171
* @return $this
7272
*/
73-
public function updateInCollection()
73+
public function updateInCollection(): self
7474
{
7575
$this->parent->update($this);
7676

@@ -397,12 +397,8 @@ public function getDataValidation()
397397

398398
/**
399399
* Set Data validation rules.
400-
*
401-
* @param DataValidation $dataValidation
402-
*
403-
* @return Cell
404400
*/
405-
public function setDataValidation(?DataValidation $dataValidation = null)
401+
public function setDataValidation(?DataValidation $dataValidation = null): self
406402
{
407403
if (!isset($this->parent)) {
408404
throw new Exception('Cannot set data validation for cell that is not bound to a worksheet');
@@ -456,8 +452,6 @@ public function getHyperlink()
456452
/**
457453
* Set Hyperlink.
458454
*
459-
* @param Hyperlink $hyperlink
460-
*
461455
* @return Cell
462456
*/
463457
public function setHyperlink(?Hyperlink $hyperlink = null)

src/PhpSpreadsheet/Chart/Chart.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,6 @@ public function getWorksheet()
186186
/**
187187
* Set Worksheet.
188188
*
189-
* @param Worksheet $worksheet
190-
*
191189
* @return $this
192190
*/
193191
public function setWorksheet(?Worksheet $worksheet = null)

src/PhpSpreadsheet/Collection/Cells.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public function cloneCellCollection(Worksheet $worksheet)
325325
// Change prefix
326326
$newCollection->cachePrefix = $newCollection->getUniqueID();
327327
foreach ($oldValues as $oldKey => $value) {
328-
/** @var string */
328+
/** @var string $newKey */
329329
$newKey = str_replace($oldCachePrefix, $newCollection->cachePrefix, $oldKey);
330330
$newValues[$newKey] = clone $value;
331331
}

src/PhpSpreadsheet/Reader/Html.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,12 +757,11 @@ public function setSheetIndex($sheetIndex)
757757
* TODO :
758758
* - Implement to other propertie, such as border
759759
*
760-
* @param Worksheet $sheet
761760
* @param int $row
762761
* @param string $column
763762
* @param array $attributeArray
764763
*/
765-
private function applyInlineStyle(&$sheet, $row, $column, $attributeArray): void
764+
private function applyInlineStyle(Worksheet &$sheet, $row, $column, $attributeArray): void
766765
{
767766
if (!isset($attributeArray['style'])) {
768767
return;

src/PhpSpreadsheet/Reader/Xlsx.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,11 +1843,9 @@ private static function boolean($value)
18431843
}
18441844

18451845
/**
1846-
* @param \PhpOffice\PhpSpreadsheet\Worksheet\Drawing $objDrawing
1847-
* @param SimpleXMLElement $cellAnchor
18481846
* @param array $hyperlinks
18491847
*/
1850-
private function readHyperLinkDrawing($objDrawing, $cellAnchor, $hyperlinks): void
1848+
private function readHyperLinkDrawing(\PhpOffice\PhpSpreadsheet\Worksheet\Drawing $objDrawing, SimpleXMLElement $cellAnchor, $hyperlinks): void
18511849
{
18521850
$hlinkClick = $cellAnchor->pic->nvPicPr->cNvPr->children(Namespaces::DRAWINGML)->hlinkClick;
18531851

src/PhpSpreadsheet/Reader/Xlsx/ColumnAndRowAttributes.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,7 @@ private function setRowAttributes($rowNumber, array $rowAttributes): void
7272
}
7373
}
7474

75-
/**
76-
* @param IReadFilter $readFilter
77-
* @param bool $readDataOnly
78-
*/
79-
public function load(?IReadFilter $readFilter = null, $readDataOnly = false): void
75+
public function load(?IReadFilter $readFilter = null, bool $readDataOnly = false): void
8076
{
8177
if ($this->worksheetXml === null) {
8278
return;

src/PhpSpreadsheet/RichText/RichText.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ class RichText implements IComparable
1717

1818
/**
1919
* Create a new RichText instance.
20-
*
21-
* @param Cell $cell
2220
*/
2321
public function __construct(?Cell $cell = null)
2422
{

src/PhpSpreadsheet/Shared/Escher/DgContainer/SpgrContainer.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class SpgrContainer
77
/**
88
* Parent Shape Group Container.
99
*
10-
* @var \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer
10+
* @var null|SpgrContainer
1111
*/
1212
private $parent;
1313

@@ -20,20 +20,16 @@ class SpgrContainer
2020

2121
/**
2222
* Set parent Shape Group Container.
23-
*
24-
* @param \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer $parent
2523
*/
26-
public function setParent($parent): void
24+
public function setParent(?self $parent): void
2725
{
2826
$this->parent = $parent;
2927
}
3028

3129
/**
3230
* Get the parent Shape Group Container if any.
33-
*
34-
* @return null|\PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer
3531
*/
36-
public function getParent()
32+
public function getParent(): ?self
3733
{
3834
return $this->parent;
3935
}

0 commit comments

Comments
 (0)