PHP - Using the PSR-20 Clock | Daniel Opitz - Blog
Handling time can be a tricky task, especially when it comes to testing and ensuring predictable results. PHP provides various functions like time(), microtime() and the \DateTimeImmutable class to fetch the current time, but the problem is when \DateTimeImmutable is hard-coded into logic, unit tests will not be reliable. This is where the ClockInterface comes into play.
PHP - Using the PSR-20 Clock | Daniel Opitz - Blog
Handling time can be a tricky task, especially when it comes to testing and ensuring predictable results. PHP provides various functions like time(), microtime() and the \DateTimeImmutable class to fetch the current time, but the problem is when \DateTimeImmutable is hard-coded into logic, unit tests will not be reliable. This is where the ClockInterface comes into play.
https://odan.github.io/2023/11/16/clock-psr20-datetime.html