Skip to content

Commit

Permalink
Fix withContext on contextException
Browse files Browse the repository at this point in the history
  • Loading branch information
charrondev committed Sep 13, 2023
1 parent e090a51 commit 52f810d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ContextException.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ public function __construct(string $message = "", int $code = 0, array $context
/**
* Add extra context to an exception.
*
* This can't be an immutable clone because exceptions aren't cloneable.
*
* @param array $context
*
* @return $this
*/
public function withContext(array $context): self
{
$ex = clone $this;
$ex->context = array_replace($ex->context, $context);
$this->context = array_replace($this->context, $context);

return $ex;
return $this;
}

/**
Expand Down

0 comments on commit 52f810d

Please sign in to comment.