@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Spatie\Period; |
4 | 4 | |
5 | -use Iterator; |
|
6 | -use Countable; |
|
7 | 5 | use ArrayAccess; |
6 | +use Countable; |
|
7 | +use Iterator; |
|
8 | 8 | |
9 | 9 | class PeriodCollection implements ArrayAccess, Iterator, Countable |
10 | 10 | { |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Spatie\Period; |
4 | 4 | |
5 | -use DateTime; |
|
6 | -use DatePeriod; |
|
7 | 5 | use DateInterval; |
6 | +use DatePeriod; |
|
7 | +use DateTime; |
|
8 | 8 | use DateTimeImmutable; |
9 | 9 | use DateTimeInterface; |
10 | 10 | use IteratorAggregate; |
11 | +use Spatie\Period\Exceptions\CannotComparePeriods; |
|
11 | 12 | use Spatie\Period\Exceptions\InvalidDate; |
12 | 13 | use Spatie\Period\Exceptions\InvalidPeriod; |
13 | -use Spatie\Period\Exceptions\CannotComparePeriods; |
|
14 | 14 | |
15 | 15 | class Period implements IteratorAggregate |
16 | 16 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param int|null $boundaryExclusionMask |
69 | 69 | * @param string|null $format |
70 | 70 | * |
71 | - * @return \Spatie\Period\Period&static |
|
71 | + * @return Period |
|
72 | 72 | */ |
73 | 73 | public static function make( |
74 | 74 | $start, |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | /** |
270 | 270 | * @param \Spatie\Period\Period $period |
271 | 271 | * |
272 | - * @return \Spatie\Period\Period&static|null |
|
272 | + * @return null|Period |
|
273 | 273 | * @throws \Exception |
274 | 274 | */ |
275 | 275 | public function gap(Period $period): ?Period |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | /** |
303 | 303 | * @param \Spatie\Period\Period $period |
304 | 304 | * |
305 | - * @return \Spatie\Period\Period&static|null |
|
305 | + * @return null|Period |
|
306 | 306 | */ |
307 | 307 | public function overlapSingle(Period $period): ?Period |
308 | 308 | { |
@@ -325,6 +325,7 @@ discard block |
||
325 | 325 | |
326 | 326 | /** |
327 | 327 | * @param \Spatie\Period\Period ...$periods |
328 | + * @param Period[] $periods |
|
328 | 329 | * |
329 | 330 | * @return \Spatie\Period\PeriodCollection|static[] |
330 | 331 | */ |
@@ -347,8 +348,9 @@ discard block |
||
347 | 348 | |
348 | 349 | /** |
349 | 350 | * @param \Spatie\Period\Period ...$periods |
351 | + * @param Period[] $periods |
|
350 | 352 | * |
351 | - * @return \Spatie\Period\Period&static |
|
353 | + * @return Period |
|
352 | 354 | */ |
353 | 355 | public function overlapAll(Period ...$periods): Period |
354 | 356 | { |
@@ -409,6 +411,7 @@ discard block |
||
409 | 411 | |
410 | 412 | /** |
411 | 413 | * @param \Spatie\Period\Period ...$periods |
414 | + * @param Period[] $periods |
|
412 | 415 | * |
413 | 416 | * @return \Spatie\Period\PeriodCollection|static[] |
414 | 417 | */ |
@@ -451,6 +454,9 @@ discard block |
||
451 | 454 | ); |
452 | 455 | } |
453 | 456 | |
457 | + /** |
|
458 | + * @param string|null $format |
|
459 | + */ |
|
454 | 460 | protected static function resolveDate($date, ?string $format): DateTimeImmutable |
455 | 461 | { |
456 | 462 | if ($date instanceof DateTimeImmutable) { |