From 4f04d687c53cceeb4d7f1ca6c98dfdc52e6a860a Mon Sep 17 00:00:00 2001 From: quietone <quietone@2572884.no-reply.drupal.org> Date: Wed, 18 Dec 2024 17:33:18 +1300 Subject: [PATCH] Issue #3480732 by debrup, joachim, gaurav gupta: Correct docs for CachePluginBase::cacheSetMaxAge() --- core/.phpstan-baseline.php | 12 ------------ .../views/src/Plugin/views/cache/CachePluginBase.php | 11 +++++++---- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index ea1c32fc6e5f..b09dab6532d6 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -46881,12 +46881,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/src/Plugin/views/cache/CachePluginBase.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views\\\\Plugin\\\\views\\\\cache\\\\CachePluginBase\\:\\:cacheSetMaxAge\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/src/Plugin/views/cache/CachePluginBase.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views\\\\Plugin\\\\views\\\\cache\\\\CachePluginBase\\:\\:getDefaultCacheMaxAge\\(\\) has no return type specified\\.$#', @@ -46947,12 +46941,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/src/Plugin/views/cache/Time.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views\\\\Plugin\\\\views\\\\cache\\\\Time\\:\\:cacheSetMaxAge\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/src/Plugin/views/cache/Time.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views\\\\Plugin\\\\views\\\\cache\\\\Time\\:\\:getDefaultCacheMaxAge\\(\\) has no return type specified\\.$#', diff --git a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php index c10ba31bf76f..223bfe62a012 100644 --- a/core/modules/views/src/Plugin/views/cache/CachePluginBase.php +++ b/core/modules/views/src/Plugin/views/cache/CachePluginBase.php @@ -82,14 +82,17 @@ protected function cacheExpire($type) { } /** - * Determine cache expiration time. + * Determines cache expiration time based on its type. * - * Plugins must override this to implement expiration in the cache table. The - * default is CACHE_PERMANENT, indicating that the item will not be removed - * automatically from cache. + * Plugins must override this to implement expiration in the cache table. * * @param string $type * The cache type. + * + * @return int + * Either an offset from the request time to indicate when the cache + * expires, or \Drupal\Core\Cache\Cache::PERMANENT to indicate that the + * cache does not expire. Defaults to \Drupal\Core\Cache\Cache::PERMANENT. */ protected function cacheSetMaxAge($type) { return Cache::PERMANENT; -- GitLab