Skip to content

Commit d6f5afb

Browse files
author
Emre Çalışkan
committed
Added PHP 8.4 support
1 parent 1e9d506 commit d6f5afb

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/Carbon/CarbonTimeZone.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function getAbbr($dst = false)
155155
*
156156
* @return string
157157
*/
158-
public function toOffsetName(DateTimeInterface $date = null)
158+
public function toOffsetName(?DateTimeInterface $date = null)
159159
{
160160
return static::getOffsetNameFromMinuteOffset(
161161
$this->getOffset($date ?: Carbon::now($this)) / 60
@@ -169,7 +169,7 @@ public function toOffsetName(DateTimeInterface $date = null)
169169
*
170170
* @return CarbonTimeZone
171171
*/
172-
public function toOffsetTimeZone(DateTimeInterface $date = null)
172+
public function toOffsetTimeZone(?DateTimeInterface $date = null)
173173
{
174174
return new static($this->toOffsetName($date));
175175
}
@@ -185,7 +185,7 @@ public function toOffsetTimeZone(DateTimeInterface $date = null)
185185
*
186186
* @return string|false
187187
*/
188-
public function toRegionName(DateTimeInterface $date = null, $isDst = 1)
188+
public function toRegionName(?DateTimeInterface $date = null, $isDst = 1)
189189
{
190190
$name = $this->getName();
191191
$firstChar = substr($name, 0, 1);
@@ -227,7 +227,7 @@ public function toRegionName(DateTimeInterface $date = null, $isDst = 1)
227227
*
228228
* @return CarbonTimeZone|false
229229
*/
230-
public function toRegionTimeZone(DateTimeInterface $date = null)
230+
public function toRegionTimeZone(?DateTimeInterface $date = null)
231231
{
232232
$tz = $this->toRegionName($date);
233233

src/Carbon/Traits/Date.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,7 +1391,7 @@ public function isoWeekday($value = null)
13911391
*
13921392
* @return int
13931393
*/
1394-
public function getDaysFromStartOfWeek(int $weekStartsAt = null): int
1394+
public function getDaysFromStartOfWeek(?int $weekStartsAt = null): int
13951395
{
13961396
$firstDay = (int) ($weekStartsAt ?? $this->getTranslationMessage('first_day_of_week') ?? 0);
13971397

@@ -1409,7 +1409,7 @@ public function getDaysFromStartOfWeek(int $weekStartsAt = null): int
14091409
*
14101410
* @return static
14111411
*/
1412-
public function setDaysFromStartOfWeek(int $numberOfDays, int $weekStartsAt = null)
1412+
public function setDaysFromStartOfWeek(int $numberOfDays, ?int $weekStartsAt = null)
14131413
{
14141414
return $this->addDays($numberOfDays - $this->getDaysFromStartOfWeek($weekStartsAt));
14151415
}
@@ -1478,7 +1478,7 @@ public function subUnitNoOverflow($valueUnit, $value, $overflowUnit)
14781478
*
14791479
* @return int|static
14801480
*/
1481-
public function utcOffset(int $minuteOffset = null)
1481+
public function utcOffset(?int $minuteOffset = null)
14821482
{
14831483
if (\func_num_args() < 1) {
14841484
return $this->offsetMinutes;

src/Carbon/Traits/Localization.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ public function translateTimeStringTo($timeString, $to = null)
444444
*
445445
* @return $this|string
446446
*/
447-
public function locale(string $locale = null, ...$fallbackLocales)
447+
public function locale(?string $locale = null, ...$fallbackLocales)
448448
{
449449
if ($locale === null) {
450450
return $this->getTranslatorLocale();

src/Carbon/Traits/Test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ protected static function mockConstructorParameters(&$time, $tz)
200200
: $testInstance->format(static::MOCK_DATETIME_FORMAT);
201201
}
202202

203-
private static function setDefaultTimezone($timezone, DateTimeInterface $date = null)
203+
private static function setDefaultTimezone($timezone, ?DateTimeInterface $date = null)
204204
{
205205
$previous = null;
206206
$success = false;

0 commit comments

Comments
 (0)