Problem/Motivation
Follow up to #3501375: Implement PSR-20 in datetime.time service where we added a new \Psr\ClockInterface
service we can inject.
We should switch from using \Drupal\Component\Datetime\TimeInterface::getCurrentTime()
and instead use the PSR-20 \Psr\ClockInterface::now()->getTimestamp()
for PHP interoperability.
We can also add a \Drupal::clock()
method to help with non-dependency injected code.
Steps to reproduce
Proposed resolution
- Deprecate
\Drupal\Component\Datetime\TimeInterface::getCurrentTime()
- Add a code>\Drupal::clock() method
- Replace instances of
\Drupal\Component\Datetime\TimeInterface::getCurrentTime()
with\Psr\ClockInterface::now()->getTimestamp()