Skip to content

Commit b03086a

Browse files
committed
🚑 fixed PHP 8 inconsistency
1 parent 735996d commit b03086a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/Headers.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,16 @@ public static function get($params, bool $safeOutput = false)
6969
/**
7070
* Set a new header
7171
*/
72-
public static function set($key, string $value = "", $replace = true, $httpCode = null): void
72+
public static function set($key, string $value = "", $replace = true, int $httpCode = 200): void
7373
{
7474
if (!is_array($key)) {
75-
header("$key: $value", $replace, $httpCode ?? self::$httpCode);
75+
$code = ($httpCode || self::$httpCode);
76+
77+
if (!$code) {
78+
header("$key: $value", $replace);
79+
} else {
80+
header("$key: $value", $replace, $code);
81+
}
7682
} else {
7783
foreach ($key as $header => $headerValue) {
7884
self::set($header, $headerValue, $replace, $httpCode);

0 commit comments

Comments
 (0)