Skip to content

Commit 67d0deb

Browse files
committed
Fixed 0 array
1 parent a6a8bae commit 67d0deb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/ApiProblem.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ApiProblem
5959
/**
6060
* HTTP status for the error.
6161
*/
62-
protected int $status;
62+
protected ?int $status = null;
6363

6464
/**
6565
* Normalized property names for overloading.
@@ -230,11 +230,11 @@ public function response(...$params)
230230
// Use current object
231231
$apProblem = $this;
232232
} else {
233-
$status = $params[2] ?? null;
234-
$detail = $params[1] ?? null;
235-
$type = $params[3] ?? null;
236-
$title = $params[4] ?? null;
237-
$additional = $params[5] ?? null;
233+
$status = $params[1] ?? null;
234+
$detail = $params[0] ?? null;
235+
$type = $params[2] ?? null;
236+
$title = $params[3] ?? null;
237+
$additional = $params[4] ?? [];
238238

239239
// Called from a Facade, use local object
240240
$apiProblem = new ApiProblem($status, $detail, $type, $title, $additional);
@@ -277,7 +277,7 @@ protected function getDetail(): string
277277
* If an exception was provided, creates the status code from it;
278278
* otherwise, code as provided is used.
279279
*/
280-
protected function getStatus(): int
280+
protected function getStatus(): ?int
281281
{
282282
if ($this->detail instanceof Throwable || $this->detail instanceof Exception) {
283283
$this->status = (int) $this->createStatusFromException();

0 commit comments

Comments
 (0)