This repository was archived by the owner on Oct 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +32
-18
lines changed Expand file tree Collapse file tree 7 files changed +32
-18
lines changed Original file line number Diff line number Diff line change 44
55namespace GeekCell \Ddd \Contracts \Domain ;
66
7- use Countable ;
8- use IteratorAggregate ;
9-
10- interface Paginator extends Countable, IteratorAggregate
7+ /**
8+ * @template T of object
9+ * @extends \IteratorAggregate<T>
10+ */
11+ interface Paginator extends \Countable, \IteratorAggregate
1112{
1213 /**
1314 * Returns the current page.
Original file line number Diff line number Diff line change 44
55namespace GeekCell \Ddd \Contracts \Domain ;
66
7- use Countable ;
87use GeekCell \Ddd \Domain \Collection ;
9- use IteratorAggregate ;
108
11- interface Repository extends Countable, IteratorAggregate
9+ /**
10+ * @template T of object
11+ * @extends \IteratorAggregate<T>
12+ */
13+ interface Repository extends \Countable, \IteratorAggregate
1214{
1315 /**
1416 * Returns a collection of items.
1517 *
16- * @return Collection
18+ * @return Collection<T>
1719 */
1820 public function collect (): Collection ;
1921
@@ -23,7 +25,7 @@ public function collect(): Collection;
2325 * @param int $itemsPerPage
2426 * @param int $currentPage
2527 *
26- * @return Paginator
28+ * @return Paginator<T>
2729 */
2830 public function paginate (
2931 int $ itemsPerPage ,
Original file line number Diff line number Diff line change 66
77use Assert ;
88
9+ /**
10+ * @template T of object
11+ * @extends \IteratorAggregate<T>
12+ */
913class Collection implements \ArrayAccess, \Countable, \IteratorAggregate
1014{
1115 /**
12- * @template T of object
13- * @extends \IteratorAggregate<T>
14- *
1516 * @param T[] $items
16- * @param class-string<T> $itemType
17+ * @param class-string<T>|null $itemType
1718 *
1819 * @throws Assert\AssertionFailedException
1920 */
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ final public function __construct(int $id)
2929 /**
3030 * @inheritDoc
3131 */
32- public function getValue (): mixed
32+ public function getValue (): int
3333 {
3434 return $ this ->id ;
3535 }
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public function equals(ValueObjectInterface $object): bool
5555 /**
5656 * @inheritDoc
5757 */
58- public function getValue (): mixed
58+ public function getValue (): string
5959 {
6060 return $ this ->uuid ;
6161 }
Original file line number Diff line number Diff line change 1111use LimitIterator ;
1212use Traversable ;
1313
14+ /**
15+ * @template T of object
16+ * @extends PaginatorInterface<T>
17+ */
1418class Paginator implements PaginatorInterface, ArrayAccess
1519{
20+ /**
21+ * @param Collection<T> $collection
22+ * @param int $itemsPerPage
23+ * @param int $currentPage
24+ */
1625 public function __construct (
1726 private readonly Collection $ collection ,
1827 private int $ itemsPerPage ,
Original file line number Diff line number Diff line change 1111use GeekCell \Ddd \Infrastructure \InMemory \Paginator as InMemoryPaginator ;
1212use Traversable ;
1313
14+ /**
15+ * @template T of object
16+ * @extends RepositoryInterface<T>
17+ */
1418abstract class Repository implements RepositoryInterface
1519{
1620 /**
@@ -19,9 +23,6 @@ abstract class Repository implements RepositoryInterface
1923 protected array $ items = [];
2024
2125 /**
22- * @template T of object
23- * @extends IteratorAggregate<T>
24- *
2526 * @param class-string<T> $itemType
2627 */
2728 public function __construct (
You can’t perform that action at this time.
0 commit comments