Skip to content

Commit a8b6671

Browse files
committed
fix header depreciation with 8.1
1 parent fb246ee commit a8b6671

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/Ubiquity/utils/http/foundation/SwooleHttp.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* This class is part of Ubiquity
88
*
99
* @author jcheron <myaddressmail@gmail.com>
10-
* @version 1.0.0
11-
*
10+
* @version 1.0.1
11+
*
1212
*/
1313
class SwooleHttp extends AbstractHttp {
1414

@@ -32,9 +32,9 @@ public function getAllHeaders() {
3232
return $this->headers;
3333
}
3434

35-
public function header($key, $value, bool $replace = true, int $http_response_code = null) {
35+
public function header($key, $value, bool $replace = true, int $http_response_code = 0) {
3636
$this->headers[$key] = $value;
37-
if ($http_response_code != null) {
37+
if ($http_response_code != 0) {
3838
$this->responseCode = $http_response_code;
3939
$this->response->status($http_response_code);
4040
}
@@ -84,8 +84,8 @@ public function getInput() {
8484
}
8585

8686
private function getFirstValue($elements) {
87-
if (is_array($elements)) {
88-
return current($elements);
87+
if (\is_array($elements)) {
88+
return \current($elements);
8989
}
9090
return $elements;
9191
}
@@ -102,7 +102,7 @@ public function setRequest(\Swoole\Http\Request $request, \Swoole\Http\Response
102102
'Content-Type' => 'text/html; charset=utf-8',
103103
'Server' => $request->request['server'] ?? 'Swoole'
104104
];
105-
if (is_array($response->header)) {
105+
if (\is_array($response->header)) {
106106
$headers = (array_merge($default, $response->header));
107107
} else {
108108
$headers = $default;

0 commit comments

Comments
 (0)