We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6a9b92 commit 687479eCopy full SHA for 687479e
src/Infrastructure/InMemory/Repository.php
@@ -17,18 +17,16 @@
17
*/
18
abstract class Repository implements RepositoryInterface
19
{
20
- /**
21
- * @var T[]
22
- */
23
- protected array $items = [];
24
-
25
/**
26
* @param class-string<T> $itemType
+ * @param T[] $items
27
28
public function __construct(
29
private string $itemType,
+ protected array $items = []
30
) {
31
Assert::that($this->itemType)->classExists();
+ Assert::thatAll($this->items)->isInstanceOf($this->itemType);
32
}
33
34
0 commit comments