-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from Planetbiru/feature/2.0
Feature/2.0
- Loading branch information
Showing
3 changed files
with
105 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
namespace MagicObject\Exceptions; | ||
|
||
use Exception; | ||
use Throwable; | ||
|
||
/** | ||
* Class InvalidReturnTypeException | ||
* | ||
* Exception thrown when an invalid return type is encountered. | ||
* | ||
* @package MagicObject\Exceptions | ||
*/ | ||
class InvalidReturnTypeException extends Exception | ||
{ | ||
/** | ||
* Previous exception | ||
* | ||
* @var Throwable|null | ||
*/ | ||
private $previous; | ||
|
||
/** | ||
* Constructor for InvalidReturnTypeException. | ||
* | ||
* @param string $message Exception message | ||
* @param int $code Exception code (default: 0) | ||
* @param Throwable|null $previous Previous exception (optional) | ||
*/ | ||
public function __construct($message, $code = 0, $previous = null) | ||
{ | ||
parent::__construct($message, $code, $previous); | ||
$this->previous = $previous; | ||
} | ||
|
||
/** | ||
* Get the previous exception. | ||
* | ||
* Returns the previous exception if it exists, or null if there is no previous exception. | ||
* | ||
* @return Throwable|null The previous exception | ||
*/ | ||
public function getPreviousException() | ||
{ | ||
return $this->previous; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters