File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515
1616final class PetRepository implements RepositoryInterface
1717{
18+ private const string TYPE_ERROR_PATTERN = '%s() expects parameter 1 to be %s, %s given ' ;
19+
1820 public function __construct (private readonly DocumentManager $ documentManager ) {}
1921
2022 /**
@@ -25,7 +27,7 @@ public function resolveCollection(CollectionInterface $petCollection): void
2527 if (!$ petCollection instanceof PetCollection) {
2628 throw new \TypeError (
2729 \sprintf (
28- ' %s() expects parameter 1 to be %s, %s given ' ,
30+ self :: TYPE_ERROR_PATTERN ,
2931 __METHOD__ ,
3032 PetCollection::class,
3133 $ petCollection ::class
@@ -77,7 +79,7 @@ public function persist(ModelInterface $pet): void
7779 if (!$ pet instanceof Pet) {
7880 throw new \TypeError (
7981 \sprintf (
80- ' %s() expects parameter 1 to be %s, %s given ' ,
82+ self :: TYPE_ERROR_PATTERN ,
8183 __METHOD__ ,
8284 Pet::class,
8385 $ pet ::class
@@ -93,7 +95,7 @@ public function remove(ModelInterface $pet): void
9395 if (!$ pet instanceof Pet) {
9496 throw new \TypeError (
9597 \sprintf (
96- ' %s() expects parameter 1 to be %s, %s given ' ,
98+ self :: TYPE_ERROR_PATTERN ,
9799 __METHOD__ ,
98100 Pet::class,
99101 $ pet ::class
You can’t perform that action at this time.
0 commit comments