briannesbitt / Carbon

@@ -1768,7 +1768,7 @@
Loading
1768 1768
        foreach ($this as $date) {
1769 1769
            if (++$attempts > static::END_MAX_ATTEMPTS) {
1770 1770
                throw new UnreachableException(
1771 -
                    'Could not calculate period end after iterating ' . static::END_MAX_ATTEMPTS . ' times.'
1771 +
                    'Could not calculate period end after iterating '.static::END_MAX_ATTEMPTS.' times.'
1772 1772
                );
1773 1773
            }
1774 1774
        }

@@ -513,12 +513,6 @@
Loading
513 513
        __clone as dateTraitClone;
514 514
    }
515 515
516 -
    /** @var bool */
517 -
    protected $endOfTime = false;
518 -
519 -
    /** @var bool */
520 -
    protected $startOfTime = false;
521 -
522 516
    public function __clone()
523 517
    {
524 518
        $this->dateTraitClone();
@@ -533,7 +527,7 @@
Loading
533 527
     */
534 528
    public static function startOfTime(): self
535 529
    {
536 -
        $date = static::parse('0001-01-01')->years(-99999999999999999);
530 +
        $date = static::parse('0001-01-01')->years(self::getStartOfTimeYear());
537 531
        $date->startOfTime = true;
538 532
539 533
        return $date;
@@ -546,9 +540,33 @@
Loading
546 540
     */
547 541
    public static function endOfTime(): self
548 542
    {
549 -
        $date = static::parse('9999-12-31')->years(99999999999999999);
543 +
        $date = static::parse('9999-12-31 23:59:59.999999')->years(self::getEndOfTimeYear());
550 544
        $date->endOfTime = true;
551 545
552 546
        return $date;
553 547
    }
548 +
549 +
    /**
550 +
     * @codeCoverageIgnore
551 +
     */
552 +
    private static function getEndOfTimeYear(): int
553 +
    {
554 +
        if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
555 +
            return 145261681241552;
556 +
        }
557 +
558 +
        return PHP_INT_MAX;
559 +
    }
560 +
561 +
    /**
562 +
     * @codeCoverageIgnore
563 +
     */
564 +
    private static function getStartOfTimeYear(): int
565 +
    {
566 +
        if (version_compare(PHP_VERSION, '7.3.0-dev', '<')) {
567 +
            return -135908816449551;
568 +
        }
569 +
570 +
        return min(PHP_INT_MIN, -9223372036854773760);
571 +
    }
554 572
}

@@ -31,6 +31,12 @@
Loading
31 31
 */
32 32
trait Comparison
33 33
{
34 +
    /** @var bool */
35 +
    protected $endOfTime = false;
36 +
37 +
    /** @var bool */
38 +
    protected $startOfTime = false;
39 +
34 40
    /**
35 41
     * Determines if the instance is equal to another
36 42
     *
Files Coverage
src/Carbon 99.92%
Project Totals (886 files) 99.92%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading