-
-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #387 from thecodingmachine/sleep
deprecated sleep()
- Loading branch information
Showing
5 changed files
with
30 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Safe; | ||
|
||
use Safe\Exceptions\MiscException; | ||
|
||
/** | ||
* | ||
* @param int $seconds Halt time in seconds. | ||
* @return int Returns zero on success. | ||
* | ||
* If the call was interrupted by a signal, sleep returns | ||
* a non-zero value. On Windows, this value will always be | ||
* 192 (the value of the | ||
* WAIT_IO_COMPLETION constant within the Windows API). | ||
* On other platforms, the return value will be the number of seconds left to | ||
* sleep. | ||
* @throws MiscException | ||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+ | ||
*/ | ||
function sleep(int $seconds): int | ||
{ | ||
error_clear_last(); | ||
$safeResult = \sleep($seconds); | ||
if ($safeResult === false) { | ||
throw MiscException::createFromPhpError(); | ||
} | ||
return $safeResult; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters