diff --git a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php index 47221c654e..189bcb48b4 100644 --- a/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php +++ b/core/lib/Drupal/Core/Cache/Context/PagersCacheContext.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Cache\Context; use Drupal\Core\Cache\CacheableMetadata; +use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait; use Drupal\Core\Pager\PagerParametersInterface; /** @@ -13,6 +14,12 @@ * 'url.query_args.pagers:1' (to vary by the pager with ID 1). */ class PagersCacheContext implements CalculatedCacheContextInterface { + use DeprecatedServicePropertyTrait; + + /** + * {@inheritdoc} + */ + protected $deprecatedProperties = ['requestStack' => 'request_stack']; /** * The pager parameters. @@ -27,9 +34,9 @@ class PagersCacheContext implements CalculatedCacheContextInterface { * @param \Drupal\Core\Pager\PagerParametersInterface $pager_params * The pager parameters. */ - public function __construct(PagerParametersInterface $pager_params = NULL) { - if (!$pager_params) { - @trigger_error('Calling ' . __METHOD__ . ' without the $pager_params argument is deprecated in drupal:8.8.0 and is required in drupal:9.0.0. See https://www.drupal.org/node/2779457', E_USER_DEPRECATED); + public function __construct($pager_params) { + if (!($pager_params instanceof PagerParametersInterface)) { + @trigger_error('The $pager_params argument to ' . __METHOD__ . ' should implement \Drupal\Core\Pager\PagerParametersInterface in drupal:8.8.0 and is required to in drupal:9.0.0. See https://www.drupal.org/node/2779457', E_USER_DEPRECATED); $pager_params = \Drupal::service('pager.parameters'); } $this->pagerParams = $pager_params;