Problem/Motivation
A time service was added to 8.3.x in #2717207: Add a time service to provide consistent interaction with time()/microtime() and superglobals.
Core code should be updated to remove deprecated uses of REQUEST_TIME
and time()
and others.
For more informations, see the change record.
This issue deals specifically with replace those calls in services.
The services that were identified to have those calls are:
- \Drupal\Core\Asset\JsCollectionRenderer
- \Drupal\Core\Cache\ApcuBackend
- \Drupal\Core\Cache\ApcuBackendFactory
- \Drupal\Core\Cache\DatabaseBackend
- \Drupal\Core\Cache\DatabaseBackendFactory
- \Drupal\Core\Cache\MemoryBackend
- \Drupal\Core\Cache\MemoryBackendFactory
- \Drupal\Core\Cache\MemoryCounterBackendFactory
- \Drupal\Core\Cache\PhpBackend
- \Drupal\Core\Cache\PhpBackendFactory
- \Drupal\Core\EventSubscriber\FinishResponseSubscriber
- \Drupal\Core\Flood\DatabaseBackend
- \Drupal\Core\KeyValueStore\KeyValueDatabaseExpirableFactory
- \Drupal\Core\Session\SessionHandler
- \Drupal\Core\Session\SessionManager
- \Drupal\comment\CommentStatistics
- \Drupal\path_alias\AliasManager
- \Drupal\search\SearchIndex
- \Drupal\update\UpdateProcessor
- \Drupal\user\EventSubscriber\UserRequestSubscriber
Proposed resolution
- Remove deprecated uses of REQUEST_TIME
and time()
and others.
- When this issue is successful, there should be no suppressions left in core/phpstan-baseline.neon
for the above mentioned classes with the message Call to deprecated constant REQUEST_TIME: Deprecated in drupal:8.3.0 and is removed from drupal:11.0.0. Use \Drupal::time()->getRequestTime();