Skip to content

Commit 46a5308

Browse files
committed
Better PHPDocs for return
1 parent f8229b0 commit 46a5308

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

src/XlsxFastEditor.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ private function getDomFromPath(string $path): \DOMDocument
185185
* Excel can either use a base date from year 1900 (Microsoft Windows) or from year 1904 (old Apple MacOS).
186186
* https://support.microsoft.com/en-us/office/date-systems-in-excel-e7fe7167-48a9-4b96-bb53-5612a800b487
187187
* @phpstan-return 1900|1904
188+
* @return int 1900 or 1904
188189
* @throws XlsxFastEditorFileFormatException
189190
* @throws XlsxFastEditorXmlException
190191
*/
@@ -409,7 +410,7 @@ public function getRow(int $sheetNumber, int $rowNumber, int $accessMode = XlsxF
409410
/**
410411
* Get the first existing row of the worksheet.
411412
* @param int $sheetNumber Worksheet number (base 1)
412-
* @return XlsxFastEditorRow|null The first row of the worksheet if there is any row, null otherwise.
413+
* @return XlsxFastEditorRow|null The first row of the worksheet if there is any row, `null` otherwise.
413414
* @throws XlsxFastEditorFileFormatException
414415
* @throws XlsxFastEditorXmlException
415416
*/
@@ -430,7 +431,7 @@ public function getFirstRow(int $sheetNumber): ?XlsxFastEditorRow
430431
/**
431432
* Get the last existing row of the worksheet.
432433
* @param int $sheetNumber Worksheet number (base 1)
433-
* @return XlsxFastEditorRow|null The last row of the worksheet if there is any row, null otherwise.
434+
* @return XlsxFastEditorRow|null The last row of the worksheet if there is any row, `null` otherwise.
434435
* @throws XlsxFastEditorFileFormatException
435436
* @throws XlsxFastEditorXmlException
436437
*/
@@ -451,6 +452,7 @@ public function getLastRow(int $sheetNumber): ?XlsxFastEditorRow
451452
/**
452453
* Delete the specified row of the specified worksheet.
453454
* @param int $sheetNumber Worksheet number (base 1)
455+
* @return bool True if the deletion succeeds, false otherwise.
454456
* @throws XlsxFastEditorFileFormatException
455457
* @throws XlsxFastEditorXmlException
456458
*/
@@ -671,6 +673,7 @@ public function getCellAutocreate(int $sheetNumber, string $cellName): XlsxFastE
671673
*
672674
* @param int $sheetNumber Worksheet number (base 1)
673675
* @param string $cellName Cell name such as `B4`
676+
* @return string|null an integer if the cell exists and contains a formula, `null` otherwise.
674677
* @throws \InvalidArgumentException if `$cellName` has an invalid format
675678
* @throws XlsxFastEditorFileFormatException
676679
* @throws XlsxFastEditorXmlException
@@ -686,6 +689,7 @@ public function readFormula(int $sheetNumber, string $cellName): ?string
686689
*
687690
* @param int $sheetNumber Worksheet number (base 1)
688691
* @param string $cellName Cell name such as `B4`
692+
* @return float|null a float if the cell exists and contains a number, `null` otherwise.
689693
* @throws \InvalidArgumentException if `$cellName` has an invalid format
690694
* @throws XlsxFastEditorFileFormatException
691695
* @throws XlsxFastEditorXmlException
@@ -701,6 +705,7 @@ public function readFloat(int $sheetNumber, string $cellName): ?float
701705
*
702706
* @param int $sheetNumber Worksheet number (base 1)
703707
* @param string $cellName Cell name such as `B4`
708+
* @return \DateTimeImmutable|null a date if the cell exists and contains a number, `null` otherwise.
704709
* @throws \InvalidArgumentException if `$cellName` has an invalid format
705710
* @throws XlsxFastEditorFileFormatException
706711
* @throws XlsxFastEditorXmlException
@@ -716,6 +721,7 @@ public function readDateTime(int $sheetNumber, string $cellName): ?\DateTimeImmu
716721
*
717722
* @param int $sheetNumber Worksheet number (base 1)
718723
* @param string $cellName Cell name such as `B4`
724+
* @return int|null an integer if the cell exists and contains a number, `null` otherwise.
719725
* @throws \InvalidArgumentException if `$cellName` has an invalid format
720726
* @throws XlsxFastEditorFileFormatException
721727
* @throws XlsxFastEditorXmlException
@@ -755,6 +761,7 @@ public function _getSharedString(int $stringNumber): ?string
755761
*
756762
* @param int $sheetNumber Worksheet number (base 1)
757763
* @param string $cellName Cell name such as `B4`
764+
* @return string|null a string if the cell exists and contains a value, `null` otherwise.
758765
* @throws \InvalidArgumentException if `$cellName` has an invalid format
759766
* @throws XlsxFastEditorFileFormatException
760767
* @throws XlsxFastEditorXmlException
@@ -797,6 +804,7 @@ public function _getHyperlink(int $sheetNumber, string $rId): ?string
797804
*
798805
* @param int $sheetNumber Worksheet number (base 1)
799806
* @param string $cellName Cell name such as `B4`
807+
* @return string|null a string if the cell exists and contains a hyperlink, `null` otherwise.
800808
* @throws \InvalidArgumentException if `$cellName` has an invalid format
801809
* @throws XlsxFastEditorFileFormatException
802810
* @throws XlsxFastEditorXmlException

src/XlsxFastEditorCell.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function column(): string
6161
}
6262

6363
/**
64-
* Access the previous existing cell, if any, null otherwise.
64+
* Access the previous existing cell, if any, `null` otherwise.
6565
*/
6666
public function getPreviousCell(): ?XlsxFastEditorCell
6767
{
@@ -76,7 +76,7 @@ public function getPreviousCell(): ?XlsxFastEditorCell
7676
}
7777

7878
/**
79-
* Access the next existing cell, if any, null otherwise.
79+
* Access the next existing cell, if any, `null` otherwise.
8080
*/
8181
public function getNextCell(): ?XlsxFastEditorCell
8282
{
@@ -105,6 +105,7 @@ public function getRow(): XlsxFastEditorRow
105105

106106
/**
107107
* Read a formula in the given worksheet at the given cell location.
108+
* @return string|null an integer if the cell exists and contains a formula, `null` otherwise.
108109
* @throws XlsxFastEditorXmlException
109110
*/
110111
public function readFormula(): ?string
@@ -134,6 +135,7 @@ private function value(): ?string
134135

135136
/**
136137
* Read the float value of the cell.
138+
* @return float|null a float if the cell exists and contains a number, `null` otherwise.
137139
*/
138140
public function readFloat(): ?float
139141
{
@@ -146,6 +148,7 @@ public function readFloat(): ?float
146148

147149
/**
148150
* Read the date/time value of the cell, if any.
151+
* @return \DateTimeImmutable|null a date if the cell exists and contains a number, `null` otherwise.
149152
* @throws XlsxFastEditorFileFormatException
150153
* @throws XlsxFastEditorXmlException
151154
*/
@@ -165,6 +168,7 @@ public function readDateTime(): ?\DateTimeImmutable
165168

166169
/**
167170
* Read the integer value of the cell.
171+
* @return int|null an integer if the cell exists and contains a number, `null` otherwise.
168172
*/
169173
public function readInt(): ?int
170174
{
@@ -176,8 +180,8 @@ public function readInt(): ?int
176180
}
177181

178182
/**
179-
* Read the string value of the cell,
180-
* compatible with the shared string approach.
183+
* Read the string value of the cell, compatible with the shared string approach.
184+
* @return string|null a string if the cell exists and contains a value, `null` otherwise.
181185
* @throws XlsxFastEditorFileFormatException
182186
* @throws XlsxFastEditorXmlException
183187
*/
@@ -202,6 +206,7 @@ public function readString(): ?string
202206

203207
/**
204208
* Read the hyperlink value of the cell, if any.
209+
* @return string|null a string if the cell exists and contains a hyperlink, `null` otherwise.
205210
* @throws XlsxFastEditorFileFormatException
206211
* @throws XlsxFastEditorXmlException
207212
*/

src/XlsxFastEditorRow.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private function getXPath(): \DOMXPath
4949
}
5050

5151
/**
52-
* Access the previous existing row, if any, null otherwise.
52+
* Access the previous existing row, if any, `null` otherwise.
5353
*/
5454
public function getPreviousRow(): ?XlsxFastEditorRow
5555
{
@@ -64,7 +64,7 @@ public function getPreviousRow(): ?XlsxFastEditorRow
6464
}
6565

6666
/**
67-
* Access the next existing row, if any, null otherwise.
67+
* Access the next existing row, if any, `null` otherwise.
6868
*/
6969
public function getNextRow(): ?XlsxFastEditorRow
7070
{
@@ -95,7 +95,7 @@ public function cellsIterator(): \Traversable
9595

9696
/**
9797
* Get the first existing cell for a given line.
98-
* @return XlsxFastEditorCell|null The first cell of the given line if it exists, null otherwise.
98+
* @return XlsxFastEditorCell|null The first cell of the given line if it exists, `null` otherwise.
9999
*/
100100
public function getFirstCell(): ?XlsxFastEditorCell
101101
{
@@ -214,7 +214,7 @@ public function getCellAutocreate(string $cellName): XlsxFastEditorCell
214214

215215
/**
216216
* Get the last existing cell for a given line.
217-
* @return XlsxFastEditorCell|null The last cell of the given line if it exists, null otherwise.
217+
* @return XlsxFastEditorCell|null The last cell of the given line if it exists, `null` otherwise.
218218
*/
219219
public function getLastCell(): ?XlsxFastEditorCell
220220
{

0 commit comments

Comments
 (0)