-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Labels
Milestone
Description
Bug report
The signature of getenv indicates that it will accept null as the first argument:
$ php83 --rf getenv
Function [ <internal:standard> function getenv ] {
- Parameters [2] {
Parameter #0 [ <optional> ?string $name = null ]
Parameter #1 [ <optional> bool $local_only = false ]
}
- Return [ array|string|false ]
but PHPStan reports that it doesn't.
The linked playground doesn't split on PHP versions, which is something I might have expected:
$ php74 --rf getenv
Function [ <internal:standard> function getenv ] {
- Parameters [2] {
Parameter #0 [ <optional> $varname ]
Parameter #1 [ <optional> $local_only ]
}
}
but even then calling getenv(null) just returns false instead of raising any errors.
Code snippet that reproduces the problem
https://phpstan.org/r/311dcf74-0d42-411c-a4ce-c7c4061b6291
Expected output
No error (maybe error in PHP7?).
Did PHPStan help you today? Did it make you happy in any way?
Thanks for maintaining this great project!
Reactions are currently unavailable