1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Make http_response_header possibly undefined

This commit is contained in:
fluffycondor 2022-12-25 11:32:33 +06:00
parent 69da58d578
commit a077bd4351

View File

@ -612,7 +612,12 @@ class VariableFetchAnalyzer
}
if ($var_id === '$http_response_header') {
return Type::getNonEmptyList(Type::getNonFalsyString());
// $http_response_header exists only in the local scope after a successful network request
return new Union([
Type::getNonEmptyList(Type::getNonFalsyString())
], [
'possibly_undefined' => true,
]);
}
if ($var_id === '$GLOBALS') {