Skip to content

Commit 716cb9c

Browse files
authored
Correct time type return
time function returns an int, while DateTime::createFromFormat requires a string!
1 parent 0a258db commit 716cb9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/phpunit_bridge.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ is mocked so it uses the mocked time if no timestamp is specified.
540540
Other functions with an optional timestamp parameter that defaults to ``time()``
541541
will still use the system time instead of the mocked time. This means that you
542542
may need to change some code in your tests. For example, instead of ``new DateTime()``,
543-
you should use ``DateTime::createFromFormat('U', time())`` to use the mocked
543+
you should use ``DateTime::createFromFormat('U', (string) time())`` to use the mocked
544544
``time()`` function.
545545

546546
To use the ``ClockMock`` class in your test, add the ``@group time-sensitive``

0 commit comments

Comments
 (0)