File tree Expand file tree Collapse file tree 1 file changed +7
-11
lines changed
Expand file tree Collapse file tree 1 file changed +7
-11
lines changed Original file line number Diff line number Diff line change @@ -259,23 +259,19 @@ public function toQuarter(bool $range = false): int|array
259259 /**
260260 * Returns the quarter range
261261 *
262- * @return array< string> Array with start and end date of quarter in Y-m-d format
262+ * @return array{0: string, 1: string} Array with start and end date of quarter in Y-m-d format
263263 */
264264 public function toQuarterRange (): array
265265 {
266266 $ quarter = (int )ceil ((int )$ this ->format ('m ' ) / 3 );
267267 $ year = $ this ->format ('Y ' );
268268
269- switch ($ quarter ) {
270- case 1 :
271- return [$ year . '-01-01 ' , $ year . '-03-31 ' ];
272- case 2 :
273- return [$ year . '-04-01 ' , $ year . '-06-30 ' ];
274- case 3 :
275- return [$ year . '-07-01 ' , $ year . '-09-30 ' ];
276- default :
277- return [$ year . '-10-01 ' , $ year . '-12-31 ' ];
278- }
269+ return match ($ quarter ) {
270+ 1 => [$ year . '-01-01 ' , $ year . '-03-31 ' ],
271+ 2 => [$ year . '-04-01 ' , $ year . '-06-30 ' ],
272+ 3 => [$ year . '-07-01 ' , $ year . '-09-30 ' ],
273+ default => [$ year . '-10-01 ' , $ year . '-12-31 ' ],
274+ };
279275 }
280276
281277 /**
You can’t perform that action at this time.
0 commit comments