Issue #2999614: Use Drupal core time service with fallback
1 unresolved thread
Closes #2999614
Merge request reports
Activity
125 125 * @see Drupal\Component\Datetime\Time::getRequestTime() 126 126 */ 127 127 public static function getRequestTime() { 128 return (int) $_SERVER['REQUEST_TIME'] ?? time(); 128 try { 129 // @phpstan-ignore-next-line 130 return \Drupal::time()->getRequestTime(); We cannot inject the time service since it isn't guaranteed to be always available (see fabianx comment at https://drupal.org/i/2999614#comment-12787538), but I can add a static cache, indeed.
I also didn't see any reason to be public here, but now it is already part of the API, we shouldn't change the visibility anymore.
changed this line in version 2 of the diff
added 1 commit
Please register or sign in to reply