File tree 7 files changed +32
-18
lines changed
7 files changed +32
-18
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace GeekCell \Ddd \Contracts \Domain ;
6
6
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
11
12
{
12
13
/**
13
14
* Returns the current page.
Original file line number Diff line number Diff line change 4
4
5
5
namespace GeekCell \Ddd \Contracts \Domain ;
6
6
7
- use Countable ;
8
7
use GeekCell \Ddd \Domain \Collection ;
9
- use IteratorAggregate ;
10
8
11
- interface Repository extends Countable, IteratorAggregate
9
+ /**
10
+ * @template T of object
11
+ * @extends \IteratorAggregate<T>
12
+ */
13
+ interface Repository extends \Countable, \IteratorAggregate
12
14
{
13
15
/**
14
16
* Returns a collection of items.
15
17
*
16
- * @return Collection
18
+ * @return Collection<T>
17
19
*/
18
20
public function collect (): Collection ;
19
21
@@ -23,7 +25,7 @@ public function collect(): Collection;
23
25
* @param int $itemsPerPage
24
26
* @param int $currentPage
25
27
*
26
- * @return Paginator
28
+ * @return Paginator<T>
27
29
*/
28
30
public function paginate (
29
31
int $ itemsPerPage ,
Original file line number Diff line number Diff line change 6
6
7
7
use Assert ;
8
8
9
+ /**
10
+ * @template T of object
11
+ * @extends \IteratorAggregate<T>
12
+ */
9
13
class Collection implements \ArrayAccess, \Countable, \IteratorAggregate
10
14
{
11
15
/**
12
- * @template T of object
13
- * @extends \IteratorAggregate<T>
14
- *
15
16
* @param T[] $items
16
- * @param class-string<T> $itemType
17
+ * @param class-string<T>|null $itemType
17
18
*
18
19
* @throws Assert\AssertionFailedException
19
20
*/
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ final public function __construct(int $id)
29
29
/**
30
30
* @inheritDoc
31
31
*/
32
- public function getValue (): mixed
32
+ public function getValue (): int
33
33
{
34
34
return $ this ->id ;
35
35
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public function equals(ValueObjectInterface $object): bool
55
55
/**
56
56
* @inheritDoc
57
57
*/
58
- public function getValue (): mixed
58
+ public function getValue (): string
59
59
{
60
60
return $ this ->uuid ;
61
61
}
Original file line number Diff line number Diff line change 11
11
use LimitIterator ;
12
12
use Traversable ;
13
13
14
+ /**
15
+ * @template T of object
16
+ * @extends PaginatorInterface<T>
17
+ */
14
18
class Paginator implements PaginatorInterface, ArrayAccess
15
19
{
20
+ /**
21
+ * @param Collection<T> $collection
22
+ * @param int $itemsPerPage
23
+ * @param int $currentPage
24
+ */
16
25
public function __construct (
17
26
private readonly Collection $ collection ,
18
27
private int $ itemsPerPage ,
Original file line number Diff line number Diff line change 11
11
use GeekCell \Ddd \Infrastructure \InMemory \Paginator as InMemoryPaginator ;
12
12
use Traversable ;
13
13
14
+ /**
15
+ * @template T of object
16
+ * @extends RepositoryInterface<T>
17
+ */
14
18
abstract class Repository implements RepositoryInterface
15
19
{
16
20
/**
@@ -19,9 +23,6 @@ abstract class Repository implements RepositoryInterface
19
23
protected array $ items = [];
20
24
21
25
/**
22
- * @template T of object
23
- * @extends IteratorAggregate<T>
24
- *
25
26
* @param class-string<T> $itemType
26
27
*/
27
28
public function __construct (
You can’t perform that action at this time.
0 commit comments