fix(renderer): coerce strtotime() result to int before formatting dates
date() expects int|null, but strtotime() returns int|false; cast to make the type explicit for PHPStan level 8 (the date strings are always well-formed here, so strtotime() never actually returns false).
This commit is contained in:
@@ -142,7 +142,7 @@ final class SvgRenderer
|
||||
if ($cell === null) {
|
||||
continue;
|
||||
}
|
||||
$ts = strtotime($cell['date']);
|
||||
$ts = (int) strtotime($cell['date']);
|
||||
$month = (int) date('n', $ts);
|
||||
$dom = (int) date('j', $ts);
|
||||
|
||||
@@ -197,7 +197,7 @@ final class SvgRenderer
|
||||
$y = self::MARGIN_Y + $d * self::STEP;
|
||||
$color = $colors['levels'][$this->level($cell['count'])];
|
||||
|
||||
$ts = strtotime($cell['date']);
|
||||
$ts = (int) strtotime($cell['date']);
|
||||
$suffix = $cell['count'] !== 1 ? 's' : '';
|
||||
$label = $cell['count'] > 0
|
||||
? $cell['count'] . ' contribution' . $suffix . ' on ' . date('F j, Y', $ts)
|
||||
|
||||
Reference in New Issue
Block a user