diff --git a/phpstan.neon b/phpstan.neon index 26f67eed28..148482f1f7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -26,6 +26,7 @@ parameters: - '#should return (\S*)(static|\$this)\(Carbon\\Carbon\)(\|null)? but returns Carbon\\Carbon(Interface)?(\|null)?\.$#' - '#should return (\S*)(static|\$this)\(Carbon\\CarbonImmutable\)(\|null)? but returns Carbon\\Carbon(Immutable|Interface)(\|null)?\.$#' - '#should return (\S*)\$this\(Carbon\\CarbonInterval\)(\|null)? but returns static\(Carbon\\CarbonInterval\)(\|null)?\.$#' + - '#should return (\S*)static\(Carbon\\CarbonInterval\)(\|null)? but returns Carbon\\CarbonInterval(\|null)?\.$#' - '#^PHPDoc tag @return with type Carbon\\CarbonTimeZone is not subtype of native type static\(Carbon\\CarbonTimeZone\)\.$#' - '#^PHPDoc tag @mixin contains invalid type Carbon\\Traits\\DeprecatedProperties\.$#' - '#^Access to an undefined property DatePeriod::\$include_end_date\.$#' diff --git a/src/Carbon/CarbonPeriod.php b/src/Carbon/CarbonPeriod.php index 8d8ed62153..c59f9bb6eb 100644 --- a/src/Carbon/CarbonPeriod.php +++ b/src/Carbon/CarbonPeriod.php @@ -42,9 +42,11 @@ use RuntimeException; use Throwable; +// @codeCoverageIgnoreStart require PHP_VERSION < 8.2 ? __DIR__.'/../../lazy/Carbon/ProtectedDatePeriod.php' : __DIR__.'/../../lazy/Carbon/UnprotectedDatePeriod.php'; +// @codeCoverageIgnoreEnd /** * Substitution of DatePeriod with some modifications and many more features. diff --git a/tests/CarbonInterval/FromStringTest.php b/tests/CarbonInterval/FromStringTest.php index 2f909d1599..53aaee5033 100644 --- a/tests/CarbonInterval/FromStringTest.php +++ b/tests/CarbonInterval/FromStringTest.php @@ -109,7 +109,7 @@ public static function dataForValidStrings(): Generator // big numbers yield ['1999999999999.5 hours', new CarbonInterval(0, 0, 0, 0, 1999999999999, 30, 0)]; yield [(0x7fffffffffffffff).' days', new CarbonInterval(0, 0, 0, 0x7fffffffffffffff, 0, 0, 0)]; - yield ['1999999999999.5 hours -85 minutes', new CarbonInterval(0, 0, 0, 0, 1999999999999, 115, 0)]; + yield ['1999999999999.5 hours -85 minutes', new CarbonInterval(0, 0, 0, 0, 1999999999999, -55, 0)]; yield ['2.333 seconds', new CarbonInterval(0, 0, 0, 0, 0, 0, 2, 333000)]; } diff --git a/tests/CarbonPeriod/MacroTest.php b/tests/CarbonPeriod/MacroTest.php index 740cceca6b..7ec72cde38 100644 --- a/tests/CarbonPeriod/MacroTest.php +++ b/tests/CarbonPeriod/MacroTest.php @@ -27,10 +27,8 @@ class MacroTest extends AbstractTestCase { protected function tearDown(): void { - $reflection = new ReflectionClass(static::$periodClass); - - $reflection->getProperty('macros') - ->setValue([]); + (new ReflectionClass(static::$periodClass)) + ->setStaticPropertyValue('macros', []); parent::tearDown(); }