@@ -25,7 +25,7 @@ class DateValue
2525 * Excel Function:
2626 * DATEVALUE(dateValue)
2727 *
28- * @param null|array|bool|float|int|string $dateValue Text that represents a date in a Microsoft Excel date format.
28+ * @param null|array<mixed> |bool|float|int|string $dateValue Text that represents a date in a Microsoft Excel date format.
2929 * For example, "1/30/2008" or "30-Jan-2008" are text strings within
3030 * quotation marks that represent dates. Using the default date
3131 * system in Excel for Windows, date_text must represent a date from
@@ -35,7 +35,7 @@ class DateValue
3535 * #VALUE! error value if date_text is out of this range.
3636 * Or can be an array of date values
3737 *
38- * @return array|DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
38+ * @return array<mixed> |DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
3939 * depending on the value of the ReturnDateType flag
4040 * If an array of numbers is passed as the argument, then the returned result will also be an array
4141 * with the same dimensions
@@ -86,6 +86,7 @@ public static function fromString(null|array|string|int|bool|float $dateValue):
8686 return self ::finalResults ($ PHPDateArray , $ dti , $ baseYear );
8787 }
8888
89+ /** @param mixed[] $t1 */
8990 private static function t1ToString (array $ t1 , DateTimeImmutable $ dti , bool $ yearFound ): string
9091 {
9192 if (count ($ t1 ) == 2 ) {
@@ -108,6 +109,8 @@ private static function t1ToString(array $t1, DateTimeImmutable $dti, bool $year
108109
109110 /**
110111 * Parse date.
112+ *
113+ * @return mixed[]
111114 */
112115 private static function setUpArray (string $ dateValue , DateTimeImmutable $ dti ): array
113116 {
@@ -132,20 +135,24 @@ private static function setUpArray(string $dateValue, DateTimeImmutable $dti): a
132135 /**
133136 * Final results.
134137 *
138+ * @param mixed[] $PHPDateArray
139+ *
135140 * @return DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
136141 * depending on the value of the ReturnDateType flag
137142 */
138143 private static function finalResults (array $ PHPDateArray , DateTimeImmutable $ dti , int $ baseYear ): string |float |int |DateTime
139144 {
140145 $ retValue = ExcelError::Value ();
141146 if (Helpers::dateParseSucceeded ($ PHPDateArray )) {
147+ /** @var array{year: int, month: int, day: int, hour: int, minute: int, second: int} $PHPDateArray */
142148 // Execute function
143149 Helpers::replaceIfEmpty ($ PHPDateArray ['year ' ], $ dti ->format ('Y ' ));
144150 if ($ PHPDateArray ['year ' ] < $ baseYear ) {
145151 return ExcelError::VALUE ();
146152 }
147153 Helpers::replaceIfEmpty ($ PHPDateArray ['month ' ], $ dti ->format ('m ' ));
148154 Helpers::replaceIfEmpty ($ PHPDateArray ['day ' ], $ dti ->format ('d ' ));
155+ /** @var array{year: int, month: int, day: int, hour: int, minute: int, second: int} $PHPDateArray */
149156 $ PHPDateArray ['hour ' ] = 0 ;
150157 $ PHPDateArray ['minute ' ] = 0 ;
151158 $ PHPDateArray ['second ' ] = 0 ;
@@ -161,6 +168,7 @@ private static function finalResults(array $PHPDateArray, DateTimeImmutable $dti
161168 return $ retValue ;
162169 }
163170
171+ /** @param mixed[] $array */
164172 private static function getInt (array $ array , string $ index ): int
165173 {
166174 return (array_key_exists ($ index , $ array ) && is_numeric ($ array [$ index ])) ? (int ) $ array [$ index ] : 0 ;
0 commit comments