@@ -25,7 +25,7 @@ class DateValue
25
25
* Excel Function:
26
26
* DATEVALUE(dateValue)
27
27
*
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.
29
29
* For example, "1/30/2008" or "30-Jan-2008" are text strings within
30
30
* quotation marks that represent dates. Using the default date
31
31
* system in Excel for Windows, date_text must represent a date from
@@ -35,7 +35,7 @@ class DateValue
35
35
* #VALUE! error value if date_text is out of this range.
36
36
* Or can be an array of date values
37
37
*
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,
39
39
* depending on the value of the ReturnDateType flag
40
40
* If an array of numbers is passed as the argument, then the returned result will also be an array
41
41
* with the same dimensions
@@ -86,6 +86,7 @@ public static function fromString(null|array|string|int|bool|float $dateValue):
86
86
return self ::finalResults ($ PHPDateArray , $ dti , $ baseYear );
87
87
}
88
88
89
+ /** @param mixed[] $t1 */
89
90
private static function t1ToString (array $ t1 , DateTimeImmutable $ dti , bool $ yearFound ): string
90
91
{
91
92
if (count ($ t1 ) == 2 ) {
@@ -108,6 +109,8 @@ private static function t1ToString(array $t1, DateTimeImmutable $dti, bool $year
108
109
109
110
/**
110
111
* Parse date.
112
+ *
113
+ * @return mixed[]
111
114
*/
112
115
private static function setUpArray (string $ dateValue , DateTimeImmutable $ dti ): array
113
116
{
@@ -132,20 +135,24 @@ private static function setUpArray(string $dateValue, DateTimeImmutable $dti): a
132
135
/**
133
136
* Final results.
134
137
*
138
+ * @param mixed[] $PHPDateArray
139
+ *
135
140
* @return DateTime|float|int|string Excel date/time serial value, PHP date/time serial value or PHP date/time object,
136
141
* depending on the value of the ReturnDateType flag
137
142
*/
138
143
private static function finalResults (array $ PHPDateArray , DateTimeImmutable $ dti , int $ baseYear ): string |float |int |DateTime
139
144
{
140
145
$ retValue = ExcelError::Value ();
141
146
if (Helpers::dateParseSucceeded ($ PHPDateArray )) {
147
+ /** @var array{year: int, month: int, day: int, hour: int, minute: int, second: int} $PHPDateArray */
142
148
// Execute function
143
149
Helpers::replaceIfEmpty ($ PHPDateArray ['year ' ], $ dti ->format ('Y ' ));
144
150
if ($ PHPDateArray ['year ' ] < $ baseYear ) {
145
151
return ExcelError::VALUE ();
146
152
}
147
153
Helpers::replaceIfEmpty ($ PHPDateArray ['month ' ], $ dti ->format ('m ' ));
148
154
Helpers::replaceIfEmpty ($ PHPDateArray ['day ' ], $ dti ->format ('d ' ));
155
+ /** @var array{year: int, month: int, day: int, hour: int, minute: int, second: int} $PHPDateArray */
149
156
$ PHPDateArray ['hour ' ] = 0 ;
150
157
$ PHPDateArray ['minute ' ] = 0 ;
151
158
$ PHPDateArray ['second ' ] = 0 ;
@@ -161,6 +168,7 @@ private static function finalResults(array $PHPDateArray, DateTimeImmutable $dti
161
168
return $ retValue ;
162
169
}
163
170
171
+ /** @param mixed[] $array */
164
172
private static function getInt (array $ array , string $ index ): int
165
173
{
166
174
return (array_key_exists ($ index , $ array ) && is_numeric ($ array [$ index ])) ? (int ) $ array [$ index ] : 0 ;
0 commit comments