Skip to content

Commit be78f5b

Browse files
authored
Merge pull request #387 from thecodingmachine/sleep
deprecated sleep()
2 parents 14fe494 + cf37257 commit be78f5b

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

deprecated/functionsList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'stats_stat_correlation',
6767
'stats_stat_innerproduct',
6868
'stats_variance',
69+
'sleep',
6970
'substr',
7071
'usort',
7172
'vsprintf',

deprecated/misc.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Safe;
4+
5+
use Safe\Exceptions\MiscException;
6+
7+
/**
8+
*
9+
* @param int $seconds Halt time in seconds.
10+
* @return int Returns zero on success.
11+
*
12+
* If the call was interrupted by a signal, sleep returns
13+
* a non-zero value. On Windows, this value will always be
14+
* 192 (the value of the
15+
* WAIT_IO_COMPLETION constant within the Windows API).
16+
* On other platforms, the return value will be the number of seconds left to
17+
* sleep.
18+
* @throws MiscException
19+
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
20+
*/
21+
function sleep(int $seconds): int
22+
{
23+
error_clear_last();
24+
$safeResult = \sleep($seconds);
25+
if ($safeResult === false) {
26+
throw MiscException::createFromPhpError();
27+
}
28+
return $safeResult;
29+
}

generated/functionsList.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,6 @@
913913
'simplexml_import_dom',
914914
'simplexml_load_file',
915915
'simplexml_load_string',
916-
'sleep',
917916
'socket_accept',
918917
'socket_addrinfo_bind',
919918
'socket_addrinfo_connect',

generated/misc.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -418,32 +418,6 @@ function sapi_windows_vt100_support($stream, bool $enable = null): void
418418
}
419419

420420

421-
/**
422-
*
423-
*
424-
* @param int $seconds Halt time in seconds.
425-
* @return int Returns zero on success.
426-
*
427-
* If the call was interrupted by a signal, sleep returns
428-
* a non-zero value. On Windows, this value will always be
429-
* 192 (the value of the
430-
* WAIT_IO_COMPLETION constant within the Windows API).
431-
* On other platforms, the return value will be the number of seconds left to
432-
* sleep.
433-
* @throws MiscException
434-
*
435-
*/
436-
function sleep(int $seconds): int
437-
{
438-
error_clear_last();
439-
$safeResult = \sleep($seconds);
440-
if ($safeResult === false) {
441-
throw MiscException::createFromPhpError();
442-
}
443-
return $safeResult;
444-
}
445-
446-
447421
/**
448422
* Delays program execution for the given number of
449423
* seconds and nanoseconds.

rector-migrate.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@
920920
'simplexml_import_dom' => 'Safe\simplexml_import_dom',
921921
'simplexml_load_file' => 'Safe\simplexml_load_file',
922922
'simplexml_load_string' => 'Safe\simplexml_load_string',
923-
'sleep' => 'Safe\sleep',
924923
'socket_accept' => 'Safe\socket_accept',
925924
'socket_addrinfo_bind' => 'Safe\socket_addrinfo_bind',
926925
'socket_addrinfo_connect' => 'Safe\socket_addrinfo_connect',

0 commit comments

Comments
 (0)