Skip to content

Commit

Permalink
Removed most of the typed properties to avoid breaking changes.
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Johansson <datasage@gmail.com>
  • Loading branch information
datasage committed Apr 26, 2024
1 parent 3f9d487 commit 10c85a9
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/ApiProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ public function __get($name)

/**
* Cast to an array.
*
* @return array
*/
public function toArray(): array
public function toArray()
{
$problem = [
'type' => $this->type,
Expand All @@ -228,8 +230,9 @@ public function toArray(): array
* stack trace and previous exception information.
*
* @param bool $flag
* @return ApiProblem
*/
public function setDetailIncludesStackTrace($flag): ApiProblem
public function setDetailIncludesStackTrace($flag)
{
$this->detailIncludesStackTrace = (bool) $flag;

Expand All @@ -241,8 +244,10 @@ public function setDetailIncludesStackTrace($flag): ApiProblem
*
* If an exception was provided, creates the detail message from it;
* otherwise, detail as provided is used.
*
* @return string
*/
protected function getDetail(): string
protected function getDetail()
{
if ($this->detail instanceof Throwable || $this->detail instanceof Exception) {
return $this->createDetailFromException();
Expand Down Expand Up @@ -276,8 +281,10 @@ protected function getStatus(): int
* string 'Unknown'.
*
* Otherwise, use the title provided.
*
* @return string
*/
protected function getTitle(): string
protected function getTitle()
{
if (null !== $this->title) {
return $this->title;
Expand All @@ -300,8 +307,10 @@ protected function getTitle(): string

/**
* Create detail message from an exception.
*
* @return string
*/
protected function createDetailFromException(): string
protected function createDetailFromException()
{
/** @var Exception|Throwable $e */
$e = $this->detail;
Expand Down Expand Up @@ -332,8 +341,10 @@ protected function createDetailFromException(): string

/**
* Create HTTP status from an exception.
*
* @return int|string
*/
protected function createStatusFromException(): int|string
protected function createStatusFromException()
{
/** @var Exception|Throwable $e */
$e = $this->detail;
Expand Down

0 comments on commit 10c85a9

Please sign in to comment.