diff --git a/src/Chronos.php b/src/Chronos.php index b6c7955e..9c28ec0c 100644 --- a/src/Chronos.php +++ b/src/Chronos.php @@ -236,7 +236,7 @@ class Chronos extends DateTimeImmutable implements Stringable */ public function __construct( ChronosDate|ChronosTime|DateTimeInterface|string|int|null $time = 'now', - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ) { if (is_int($time) || (is_string($time) && ctype_digit($time))) { parent::__construct("@{$time}"); @@ -468,7 +468,7 @@ public static function instance(DateTimeInterface $other): static */ public static function parse( ChronosDate|ChronosTime|DateTimeInterface|string|int|null $time = 'now', - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { return new static($time, $timezone); } @@ -568,7 +568,7 @@ public static function create( ?int $minute = null, ?int $second = null, ?int $microsecond = null, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { $now = static::now(); $year = $year ?? (int)$now->format('Y'); @@ -589,7 +589,7 @@ public static function create( $instance = static::createFromFormat( 'Y-m-d H:i:s.u', sprintf('%s-%s-%s %s:%02s:%02s.%06s', 0, $month, $day, $hour, $minute, $second, $microsecond), - $timezone + $timezone, ); return $instance->addYears($year); @@ -608,7 +608,7 @@ public static function createFromDate( ?int $year = null, ?int $month = null, ?int $day = null, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { return static::create($year, $month, $day, null, null, null, null, $timezone); } @@ -628,7 +628,7 @@ public static function createFromTime( ?int $minute = null, ?int $second = null, ?int $microsecond = null, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { return static::create(null, null, null, $hour, $minute, $second, $microsecond, $timezone); } @@ -645,7 +645,7 @@ public static function createFromTime( public static function createFromFormat( string $format, string $time, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { if ($timezone !== null) { $dateTime = parent::createFromFormat($format, $time, $timezone ? static::safeCreateDateTimeZone($timezone) : null); @@ -725,7 +725,7 @@ public static function createFromArray(array $values): static $values['hour'], $values['minute'], $values['second'], - $values['microsecond'] + $values['microsecond'], ); assert(!is_int($values['timezone']), 'Timezone cannot be of type `int`'); @@ -880,7 +880,7 @@ public function setDateTime( int $day, int $hour, int $minute, - int $second = 0 + int $second = 0, ): static { return $this->setDate($year, $month, $day)->setTime($hour, $minute, $second); } @@ -2317,7 +2317,7 @@ public function diffFiltered( callable $callback, ?DateTimeInterface $other = null, bool $absolute = true, - int $options = 0 + int $options = 0, ): int { $start = $this; $end = $other ?? static::now($this->tz); @@ -2430,7 +2430,7 @@ public function diffInDaysFiltered( callable $callback, ?DateTimeInterface $other = null, bool $absolute = true, - int $options = 0 + int $options = 0, ): int { return $this->diffFiltered(new DateInterval('P1D'), $callback, $other, $absolute, $options); } @@ -2448,7 +2448,7 @@ public function diffInHoursFiltered( callable $callback, ?DateTimeInterface $other = null, bool $absolute = true, - int $options = 0 + int $options = 0, ): int { return $this->diffFiltered(new DateInterval('PT1H'), $callback, $other, $absolute, $options); } diff --git a/src/ChronosDate.php b/src/ChronosDate.php index a60fc549..8fb9e99a 100644 --- a/src/ChronosDate.php +++ b/src/ChronosDate.php @@ -113,7 +113,7 @@ class ChronosDate implements Stringable */ public function __construct( ChronosDate|DateTimeInterface|string $time = 'now', - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ) { $this->native = $this->createNative($time, $timezone); } @@ -127,7 +127,7 @@ public function __construct( */ protected function createNative( ChronosDate|DateTimeInterface|string $time, - DateTimeZone|string|null $timezone + DateTimeZone|string|null $timezone, ): DateTimeImmutable { if (!is_string($time)) { return new DateTimeImmutable($time->format('Y-m-d 00:00:00')); @@ -1425,7 +1425,7 @@ public function diffFiltered( callable $callback, ?ChronosDate $other = null, bool $absolute = true, - int $options = 0 + int $options = 0, ): int { $start = $this; $end = $other ?? new ChronosDate(Chronos::now()); @@ -1518,7 +1518,7 @@ public function diffInDaysFiltered( callable $callback, ?ChronosDate $other = null, bool $absolute = true, - int $options = 0 + int $options = 0, ): int { return $this->diffFiltered(new DateInterval('P1D'), $callback, $other, $absolute, $options); } diff --git a/src/ChronosTime.php b/src/ChronosTime.php index 88f52d2f..aa7b8c80 100644 --- a/src/ChronosTime.php +++ b/src/ChronosTime.php @@ -79,7 +79,7 @@ class ChronosTime implements Stringable */ public function __construct( ChronosTime|DateTimeInterface|string|null $time = null, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ) { if ($time === null) { $time = Chronos::getTestNow() ?? Chronos::now(); @@ -107,7 +107,7 @@ public function __construct( */ public static function parse( ChronosTime|DateTimeInterface|string|null $time = null, - DateTimeZone|string|null $timezone = null + DateTimeZone|string|null $timezone = null, ): static { return new static($time, $timezone); } @@ -120,7 +120,7 @@ protected static function parseString(string $time): int { if (!preg_match('/^\s*(\d{1,2})[:.](\d{1,2})(?|[:.](\d{1,2})[.](\d+)|[:.](\d{1,2}))?\s*$/', $time, $matches)) { throw new InvalidArgumentException( - sprintf('Time string `%s` is not in expected format `HH[:.]mm` or `HH[:.]mm[:.]ss.u`.', $time) + sprintf('Time string `%s` is not in expected format `HH[:.]mm` or `HH[:.]mm[:.]ss.u`.', $time), ); } @@ -474,7 +474,7 @@ public function toDateTimeImmutable(DateTimeZone|string|null $timezone = null): $this->getHours(), $this->getMinutes(), $this->getSeconds(), - $this->getMicroseconds() + $this->getMicroseconds(), ); } diff --git a/src/DifferenceFormatter.php b/src/DifferenceFormatter.php index eb15a27d..3a568c79 100644 --- a/src/DifferenceFormatter.php +++ b/src/DifferenceFormatter.php @@ -49,7 +49,7 @@ public function __construct(?Translator $translate = null) public function diffForHumans( ChronosDate|DateTimeInterface $first, ChronosDate|DateTimeInterface|null $second = null, - bool $absolute = false + bool $absolute = false, ): string { $isNow = $second === null; if ($second === null) { @@ -61,7 +61,7 @@ public function diffForHumans( } assert( ($first instanceof ChronosDate && $second instanceof ChronosDate) || - ($first instanceof DateTimeInterface && $second instanceof DateTimeInterface) + ($first instanceof DateTimeInterface && $second instanceof DateTimeInterface), ); $diffInterval = $first->diff($second); diff --git a/src/DifferenceFormatterInterface.php b/src/DifferenceFormatterInterface.php index aecb512f..56746b12 100644 --- a/src/DifferenceFormatterInterface.php +++ b/src/DifferenceFormatterInterface.php @@ -31,6 +31,6 @@ interface DifferenceFormatterInterface public function diffForHumans( ChronosDate|DateTimeInterface $first, ChronosDate|DateTimeInterface|null $second = null, - bool $absolute = false + bool $absolute = false, ): string; } diff --git a/tests/TestCase/Date/ComparisonTest.php b/tests/TestCase/Date/ComparisonTest.php index 1613d456..4586b745 100644 --- a/tests/TestCase/Date/ComparisonTest.php +++ b/tests/TestCase/Date/ComparisonTest.php @@ -95,7 +95,7 @@ public function testBetweenEqualTrue() $this->assertTrue(ChronosDate::create(2000, 1, 15)->between( ChronosDate::create(2000, 1, 1), ChronosDate::create(2000, 1, 31), - true + true, )); } @@ -104,7 +104,7 @@ public function testBetweenNotEqualTrue() $this->assertTrue(ChronosDate::create(2000, 1, 15)->between( ChronosDate::create(2000, 1, 1), ChronosDate::create(2000, 1, 31), - false + false, )); } @@ -113,7 +113,7 @@ public function testBetweenEqualFalse() $this->assertFalse(ChronosDate::create(1999, 12, 31)->between( ChronosDate::create(2000, 1, 1), ChronosDate::create(2000, 1, 31), - true + true, )); } @@ -122,7 +122,7 @@ public function testBetweenNotEqualFalse() $this->assertFalse(ChronosDate::create(2000, 1, 1)->between( ChronosDate::create(2000, 1, 1), ChronosDate::create(2000, 1, 31), - false + false, )); } @@ -131,7 +131,7 @@ public function testBetweenEqualSwitchTrue() $this->assertTrue(ChronosDate::create(2000, 1, 15)->between( ChronosDate::create(2000, 1, 31), ChronosDate::create(2000, 1, 1), - true + true, )); } @@ -140,7 +140,7 @@ public function testBetweenNotEqualSwitchTrue() $this->assertTrue(ChronosDate::create(2000, 1, 15)->between( ChronosDate::create(2000, 1, 31), ChronosDate::create(2000, 1, 1), - false + false, )); } @@ -149,7 +149,7 @@ public function testBetweenEqualSwitchFalse() $this->assertFalse(ChronosDate::create(1999, 12, 31)->between( ChronosDate::create(2000, 1, 31), ChronosDate::create(2000, 1, 1), - true + true, )); } @@ -158,7 +158,7 @@ public function testBetweenNotEqualSwitchFalse() $this->assertFalse(ChronosDate::create(2000, 1, 1)->between( ChronosDate::create(2000, 1, 31), ChronosDate::create(2000, 1, 1), - false + false, )); } diff --git a/tests/TestCase/DateTime/GettersTest.php b/tests/TestCase/DateTime/GettersTest.php index 8d2fe591..dddbcd49 100644 --- a/tests/TestCase/DateTime/GettersTest.php +++ b/tests/TestCase/DateTime/GettersTest.php @@ -121,7 +121,7 @@ public function testGetAgeWithRealAge() $age = intval(substr( (string)(date('Ymd') - date('Ymd', $d->timestamp)), 0, - -4 + -4, )); $this->assertSame($age, $d->age); diff --git a/tests/TestCase/DateTime/InstanceTest.php b/tests/TestCase/DateTime/InstanceTest.php index 0264374c..54a9d974 100644 --- a/tests/TestCase/DateTime/InstanceTest.php +++ b/tests/TestCase/DateTime/InstanceTest.php @@ -32,7 +32,7 @@ public function testInstanceFromDateTimeKeepsTimezoneName() { $dating = Chronos::instance(DateTime::createFromFormat( 'Y-m-d H:i:s', - '1975-05-21 22:32:11' + '1975-05-21 22:32:11', )->setTimezone(new DateTimeZone('America/Vancouver'))); $this->assertSame('America/Vancouver', $dating->tzName); } diff --git a/tests/TestCase/TestCase.php b/tests/TestCase/TestCase.php index a12bab33..8029b822 100644 --- a/tests/TestCase/TestCase.php +++ b/tests/TestCase/TestCase.php @@ -153,7 +153,7 @@ function ($code, $message, $file, $line, $context = null) use (&$previousHandler } return false; - } + }, ); try { $callable();