mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-30 19:50:12 +02:00
update deps & install rector
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace DesignPatterns\More\Repository;
|
||||
|
||||
use OutOfBoundsException;
|
||||
use DesignPatterns\More\Repository\Domain\Post;
|
||||
use DesignPatterns\More\Repository\Domain\PostId;
|
||||
|
||||
@@ -16,10 +17,7 @@ use DesignPatterns\More\Repository\Domain\PostId;
|
||||
*/
|
||||
class PostRepository
|
||||
{
|
||||
/**
|
||||
* @var Persistence
|
||||
*/
|
||||
private $persistence;
|
||||
private Persistence $persistence;
|
||||
|
||||
public function __construct(Persistence $persistence)
|
||||
{
|
||||
@@ -35,8 +33,8 @@ class PostRepository
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->persistence->retrieve($id->toInt());
|
||||
} catch (\OutOfBoundsException $e) {
|
||||
throw new \OutOfBoundsException(sprintf('Post with id %d does not exist', $id->toInt()), 0, $e);
|
||||
} catch (OutOfBoundsException $e) {
|
||||
throw new OutOfBoundsException(sprintf('Post with id %d does not exist', $id->toInt()), 0, $e);
|
||||
}
|
||||
|
||||
return Post::fromState($arrayData);
|
||||
|
Reference in New Issue
Block a user