Skip to content

Commit

Permalink
fix time_nanosleep return type signature
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored and ondrejmirtes committed Oct 3, 2022
1 parent bb8d661 commit 8462fbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resources/functionMap.php
Expand Up @@ -12308,7 +12308,7 @@
'tidyNode::isPhp' => ['bool'],
'tidyNode::isText' => ['bool'],
'time' => ['positive-int'],
'time_nanosleep' => ['array{0:0|positive-int,1:0|positive-int}|bool', 'seconds'=>'int', 'nanoseconds'=>'int'],
'time_nanosleep' => ['array{seconds:0|positive-int,nanoseconds:0|positive-int}|bool', 'seconds'=>'int', 'nanoseconds'=>'int'],
'time_sleep_until' => ['bool', 'timestamp'=>'float'],
'timezone_abbreviations_list' => ['array'],
'timezone_identifiers_list' => ['array<int, string>', 'what='=>'int', 'country='=>'?string'],
Expand Down
Expand Up @@ -533,4 +533,9 @@ public function testBug7954(): void
$this->analyse([__DIR__ . '/data/bug-7954.php'], []);
}

public function testBug8097(): void
{
$this->analyse([__DIR__ . '/data/bug-8097.php'], []);
}

}
11 changes: 11 additions & 0 deletions tests/PHPStan/Rules/Arrays/data/bug-8097.php
@@ -0,0 +1,11 @@
<?php

namespace Bug8097;

function snooze($seconds)
{
$t = time_nanosleep($seconds, 0);
while (is_array($t)) {
$t = time_nanosleep($t['seconds'], $t['nanoseconds']);
}
}

0 comments on commit 8462fbd

Please sign in to comment.