-
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.
- Replaced messages in production classes with static constructors - Added TrackedRecordNotFoundException to avoid rethrowing default RecordNotFoundException after call stack was added - Added trait for exceptions building call stack path - Renamed InvalidArgumentException to InvalidTypeException and changed parent for InvalidIdException to native invalid argument exception - Removed redundant exception handling for decorated record composition thrown from renaming procedure
- Loading branch information
Showing
15 changed files
with
133 additions
and
69 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Polymorphine/Container package. | ||
* | ||
* (c) Shudd3r <q3.shudder@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Polymorphine\Container\Exception; | ||
|
||
|
||
trait CallStackMessageMethod | ||
{ | ||
private static function extendMessage(string $message, array $callStack, string $lastCall = '...'): string | ||
{ | ||
$stack = implode('->', array_keys($callStack)) . ($lastCall ? '->' . $lastCall : ''); | ||
return "$message [call stack: $stack]"; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Polymorphine/Container package. | ||
* | ||
* (c) Shudd3r <q3.shudder@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Polymorphine\Container\Exception; | ||
|
||
use Psr\Container\ContainerExceptionInterface; | ||
use InvalidArgumentException; | ||
|
||
|
||
class InvalidTypeException extends InvalidArgumentException implements ContainerExceptionInterface | ||
{ | ||
public static function recordExpected(string $id): self | ||
{ | ||
return new self("Setup constructor expected instance of Record as records `$id` value"); | ||
} | ||
|
||
public static function containerExpected(string $id): self | ||
{ | ||
return new self("Setup constructor expected instance of ContainerInterface as containers `$id` value"); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of Polymorphine/Container package. | ||
* | ||
* (c) Shudd3r <q3.shudder@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Polymorphine\Container\Exception; | ||
|
||
use Psr\Container\NotFoundExceptionInterface; | ||
use InvalidArgumentException; | ||
|
||
|
||
class TrackedRecordNotFoundException extends InvalidArgumentException implements NotFoundExceptionInterface | ||
{ | ||
use CallStackMessageMethod; | ||
|
||
public function __construct(string $message = '', array $callStack = []) | ||
{ | ||
parent::__construct(self::extendMessage($message, $callStack)); | ||
} | ||
} |
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
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
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