From 8462fbd5aa047af417dbffd67d0d6b89bad8cb68 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Mon, 3 Oct 2022 17:53:18 +0200 Subject: [PATCH] fix time_nanosleep return type signature --- resources/functionMap.php | 2 +- .../NonexistentOffsetInArrayDimFetchRuleTest.php | 5 +++++ tests/PHPStan/Rules/Arrays/data/bug-8097.php | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/PHPStan/Rules/Arrays/data/bug-8097.php diff --git a/resources/functionMap.php b/resources/functionMap.php index 92941b619b..171e58f521 100644 --- a/resources/functionMap.php +++ b/resources/functionMap.php @@ -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', 'what='=>'int', 'country='=>'?string'], diff --git a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php index 8cab9f70d5..013481de42 100644 --- a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php @@ -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'], []); + } + } diff --git a/tests/PHPStan/Rules/Arrays/data/bug-8097.php b/tests/PHPStan/Rules/Arrays/data/bug-8097.php new file mode 100644 index 0000000000..302f2e4de8 --- /dev/null +++ b/tests/PHPStan/Rules/Arrays/data/bug-8097.php @@ -0,0 +1,11 @@ +