Skip to content

Commit

Permalink
cs
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Dec 3, 2024
1 parent 1163553 commit e11c355
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
'equal' => false,
'identical' => false,
],
'native_constant_invocation' => true,
'native_constant_invocation' => [
'include' => [
// https://github.com/php/php-src/blob/php-8.4.0/ext/pcntl/pcntl.stub.php#L201
'SIGALRM',
],
],
'native_function_invocation' => false,
'void_return' => false,
'blank_line_before_statement' => [
Expand Down
6 changes: 3 additions & 3 deletions src/util/PcntlTimeout.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public function __construct(int $timeout)
*/
public function timeBoxed(callable $code)
{
$existingHandler = pcntl_signal_get_handler(SIGALRM);
$existingHandler = pcntl_signal_get_handler(\SIGALRM);

$signal = pcntl_signal(SIGALRM, function (): void {
$signal = pcntl_signal(\SIGALRM, function (): void {
throw new DeadlineException(sprintf(
'Timebox hit deadline of %d seconds',
$this->timeout
Expand All @@ -89,7 +89,7 @@ public function timeBoxed(callable $code)
} finally {
pcntl_alarm(0);
pcntl_signal_dispatch();
pcntl_signal(SIGALRM, $existingHandler);
pcntl_signal(\SIGALRM, $existingHandler);
}
}

Expand Down

0 comments on commit e11c355

Please sign in to comment.