Replace REQUEST_TIME in classes with direct container access

Created on 9 February 2020, almost 5 years ago
Updated 15 January 2024, 12 months ago

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 plugins and classes with direct container access.

The plugins and classes with direct container access that were identified to have those calls are:

  • \Drupal\comment\CommentForm
  • \Drupal\content_translation\Controller\ContentTranslationController
  • \Drupal\content_translation\ContentTranslationHandler
  • \Drupal\locale\Form\TranslationStatusForm
  • \Drupal\migrate_drupal_ui\Form\ReviewForm
  • \Drupal\system\DateFormatListBuilder
  • \Drupal\system\Form\DateFormatDeleteForm
  • \Drupal\system\Form\DateFormatEditForm
  • \Drupal\toolbar\Controller\ToolbarController
  • \Drupal\user\Controller\UserController

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();

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Fixed

Version

11.0 🔥

Component
Datetime 

Last updated 6 days ago

Created by

🇺🇸United States mpdonadio Philadelphia/PA/USA (UTC-5)

Live updates comments and jobs are added and updated live.

Missing content requested by

🇦🇺Australia dpi
about 1 year ago
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024