diff --git a/resources/functionMap_php80delta.php b/resources/functionMap_php80delta.php index bca5fef36b..ccebb05a2d 100644 --- a/resources/functionMap_php80delta.php +++ b/resources/functionMap_php80delta.php @@ -53,6 +53,7 @@ 'forward_static_call_array' => ['mixed', 'function'=>'callable', 'parameters'=>'array'], 'get_debug_type' => ['string', 'var'=>'mixed'], 'get_resource_id' => ['int', 'res'=>'resource'], + 'getenv' => ['string|array|false', 'name='=>'string|null', 'local_only='=>'bool'], 'gmdate' => ['string', 'format'=>'string', 'timestamp='=>'int'], 'gmmktime' => ['int|false', 'hour'=>'int', 'minute='=>'int', 'second='=>'int', 'month='=>'int', 'day='=>'int', 'year='=>'int'], 'hash' => ['non-falsy-string', 'algo'=>'string', 'data'=>'string', 'raw_output='=>'bool'], diff --git a/tests/PHPStan/Analyser/nsrt/bug-4538.php b/tests/PHPStan/Analyser/nsrt/bug-4538-php7.php similarity index 87% rename from tests/PHPStan/Analyser/nsrt/bug-4538.php rename to tests/PHPStan/Analyser/nsrt/bug-4538-php7.php index 20be659998..e7f596c8a8 100644 --- a/tests/PHPStan/Analyser/nsrt/bug-4538.php +++ b/tests/PHPStan/Analyser/nsrt/bug-4538-php7.php @@ -1,10 +1,10 @@ -= 8.0 + +namespace Bug4538; + +use function PHPStan\Testing\assertType; + +class FooPhp8 +{ + /** + * @param string $index + */ + public function bar(string $index): void + { + assertType('string|array|false', getenv($index)); + assertType('array', getenv()); + assertType('array', getenv(null)); + } +}