Skip to content

Commit

Permalink
[10.x] Allow Sleep::until() to be passed a timestamp as a string (#…
Browse files Browse the repository at this point in the history
…48883)

* Allow Sleep::until to be passed a timestamp as a string

Also loosens up the type hinting to match what is actually handled.

* Add test for milliseconds

---------

Co-authored-by: Tim MacDonald <[email protected]>
  • Loading branch information
jameshulse and timacdonald authored Nov 2, 2023
1 parent 5244b82 commit 05bdc3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sleep.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ public static function for($duration)
/**
* Sleep until the given timestamp.
*
* @param \DateTimeInterface|int $timestamp
* @param \DateTimeInterface|int|float|numeric-string $timestamp
* @return static
*/
public static function until($timestamp)
{
if (is_int($timestamp)) {
if (is_numeric($timestamp)) {
$timestamp = Carbon::createFromTimestamp($timestamp);
}

Expand Down

0 comments on commit 05bdc3d

Please sign in to comment.