From f9c571415cfffd0c8c932bd2dd258151cd4670bc Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Wed, 17 Feb 2021 13:18:55 +0100 Subject: [PATCH] proc_get_status() - array shape for PHP 8 --- resources/functionMap_php80delta.php | 2 ++ tests/PHPStan/Analyser/NodeScopeResolverTest.php | 6 ++++++ tests/PHPStan/Analyser/data/proc_get_status.php | 15 +++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/PHPStan/Analyser/data/proc_get_status.php diff --git a/resources/functionMap_php80delta.php b/resources/functionMap_php80delta.php index 767f14446e..e17864ac5c 100644 --- a/resources/functionMap_php80delta.php +++ b/resources/functionMap_php80delta.php @@ -78,6 +78,7 @@ 'PhpToken::is' => ['bool', 'kind'=>'string|int|string[]|int[]'], 'PhpToken::isIgnorable' => ['bool'], 'PhpToken::getTokenName' => ['string'], + 'proc_get_status' => ['array{command: string, pid: int, running: bool, signaled: bool, stopped: bool, exitcode: int, termsig: int, stopsig: int}', 'process'=>'resource'], 'socket_addrinfo_lookup' => ['AddressInfo[]', 'node'=>'string', 'service='=>'mixed', 'hints='=>'array'], 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => ['string|false', 'confidential_message'=>'string', 'public_message'=>'string', 'nonce'=>'string', 'key'=>'string'], 'str_contains' => ['bool', 'haystack'=>'string', 'needle'=>'string'], @@ -199,6 +200,7 @@ 'parse_str' => ['void', 'encoded_string'=>'string', '&w_result='=>'array'], 'password_hash' => ['string|false|null', 'password'=>'string', 'algo'=>'?string|?int', 'options='=>'array'], 'png2wbmp' => ['bool', 'pngname'=>'string', 'wbmpname'=>'string', 'dest_height'=>'int', 'dest_width'=>'int', 'threshold'=>'int'], + 'proc_get_status' => ['array{command: string, pid: int, running: bool, signaled: bool, stopped: bool, exitcode: int, termsig: int, stopsig: int}|false', 'process'=>'resource'], 'read_exif_data' => ['array', 'filename'=>'string', 'sections_needed='=>'string', 'sub_arrays='=>'bool', 'read_thumbnail='=>'bool'], 'sodium_crypto_aead_chacha20poly1305_ietf_decrypt' => ['?string|?false', 'confidential_message'=>'string', 'public_message'=>'string', 'nonce'=>'string', 'key'=>'string'], 'SplFileObject::fgetss' => ['string|false', 'allowable_tags='=>'string'], diff --git a/tests/PHPStan/Analyser/NodeScopeResolverTest.php b/tests/PHPStan/Analyser/NodeScopeResolverTest.php index 00140850f3..4c67ea51c4 100644 --- a/tests/PHPStan/Analyser/NodeScopeResolverTest.php +++ b/tests/PHPStan/Analyser/NodeScopeResolverTest.php @@ -10807,6 +10807,11 @@ public function dataBug4538(): array return $this->gatherAssertTypes(__DIR__ . '/data/bug-4538.php'); } + public function dataProcGetStatus(): array + { + return $this->gatherAssertTypes(__DIR__ . '/data/proc_get_status.php'); + } + /** * @param string $file * @return array @@ -11030,6 +11035,7 @@ private function gatherAssertTypes(string $file): array * @dataProvider dataBug651 * @dataProvider dataBug1283 * @dataProvider dataBug4538 + * @dataProvider dataProcGetStatus * @param string $assertType * @param string $file * @param mixed ...$args diff --git a/tests/PHPStan/Analyser/data/proc_get_status.php b/tests/PHPStan/Analyser/data/proc_get_status.php new file mode 100644 index 0000000000..86522e401e --- /dev/null +++ b/tests/PHPStan/Analyser/data/proc_get_status.php @@ -0,0 +1,15 @@ + string, \'pid\' => int, \'running\' => bool, \'signaled\' => bool, \'stopped\' => bool, \'exitcode\' => int, \'termsig\' => int, \'stopsig\' => int)', $status); +};