Skip to content

Commit

Permalink
[5.x] Fix carbon integer casting (#11496)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga authored Feb 24, 2025
1 parent 0b256e3 commit 9139cb0
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/API/AbstractCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ protected function normalizeKey($key)
*/
public function cacheExpiry()
{
return Carbon::now()->addMinutes($this->config('expiry'));
return Carbon::now()->addMinutes((int) $this->config('expiry'));
}
}
2 changes: 1 addition & 1 deletion src/Git/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function commit($message = null)
public function dispatchCommit($message = null)
{
if ($delay = config('statamic.git.dispatch_delay')) {
$delayInMinutes = now()->addMinutes($delay);
$delayInMinutes = now()->addMinutes((int) $delay);
$message = null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/ResponseCache/DefaultCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function put(Request $request, $response)
{
$key = $this->track($request);

$ttl = Carbon::now()->addMinutes(config('statamic.graphql.cache.expiry', 60));
$ttl = Carbon::now()->addMinutes((int) config('statamic.graphql.cache.expiry', 60));

Cache::put($key, $response, $ttl);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/CP/SessionTimeoutController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function __invoke()
$lastActivity = session('last_activity', now()->timestamp);

return Carbon::createFromTimestamp($lastActivity, config('app.timezone'))
->addMinutes(config('session.lifetime'))
->addMinutes((int) config('session.lifetime'))
->diffInSeconds();
}
}
2 changes: 1 addition & 1 deletion src/Providers/CacheServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private function macroRememberWithExpiration()

$keyValuePair = $callback();
$value = reset($keyValuePair);
$expiration = Carbon::now()->addMinutes(key($keyValuePair));
$expiration = Carbon::now()->addMinutes((int) key($keyValuePair));

return Cache::remember($cacheKey, $expiration, function () use ($value) {
return $value;
Expand Down
2 changes: 1 addition & 1 deletion src/StaticCaching/Cachers/AbstractCacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getBaseUrl()
*/
public function getDefaultExpiration()
{
return $this->config('expiry');
return (int) $this->config('expiry');
}

/**
Expand Down

0 comments on commit 9139cb0

Please sign in to comment.