Skip to content

Commit e47d557

Browse files
committed
feature #1 Adding phpdoc generics for the interfaces (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Adding phpdoc generics for the interfaces Commits ------- 1259978 Adding phpdoc generics for the interfaces
2 parents 439f0b3 + 1259978 commit e47d557

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/MapperInterface.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,26 @@
1414
*
1515
* Also add #[AsMapper(from: Foo:class, to: Bar:class)] to each mapper class.
1616
*
17+
* @template TFrom of object
18+
* @template TTo of object
19+
*
1720
* @author Ryan Weaver <[email protected]>
1821
*/
1922
interface MapperInterface
2023
{
24+
/**
25+
* @param TFrom $from
26+
* @param class-string<TTo> $toClass
27+
*
28+
* @return TTo
29+
*/
2130
public function load(object $from, string $toClass, array $context): object;
2231

32+
/**
33+
* @param TFrom $from
34+
* @param TTo $to
35+
*
36+
* @return TTo
37+
*/
2338
public function populate(object $from, object $to, array $context): object;
2439
}

src/MicroMapperInterface.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@
1111

1212
/**
1313
* Maps one object to another using the configured mappers.
14+
*
15+
* @template TFrom of object
16+
* @template TTo of object
1417
*/
1518
interface MicroMapperInterface
1619
{
1720
public const MAX_DEPTH = 'max_depth';
1821

22+
/**
23+
* @param TFrom $from
24+
* @param class-string<TTo> $toClass
25+
*
26+
* @return TTo
27+
*/
1928
public function map(object $from, string $toClass, array $context = []): object;
2029
}

0 commit comments

Comments
 (0)