Skip to content

Commit

Permalink
Adding phpdoc generics for the interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Aug 23, 2023
1 parent 439f0b3 commit 2ac9fe0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/MapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,26 @@
*
* Also add #[AsMapper(from: Foo:class, to: Bar:class)] to each mapper class.
*
* @template TFrom of object
* @template TTo of object
*
* @author Ryan Weaver <[email protected]>
*/
interface MapperInterface
{
/**
* @param TFrom $from
* @param class-string<TTo> $toClass
*
* @return TTo
*/
public function load(object $from, string $toClass, array $context): object;

/**
* @param TFrom $from
* @param TTo $to
*
* @return TTo
*/
public function populate(object $from, object $to, array $context): object;
}
9 changes: 9 additions & 0 deletions src/MicroMapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@

/**
* Maps one object to another using the configured mappers.
*
* @template TFrom of object
* @template TTo of object
*/
interface MicroMapperInterface
{
public const MAX_DEPTH = 'max_depth';

/**
* @param TFrom $from
* @param class-string<TTo> $toClass
*
* @return TTo
*/
public function map(object $from, string $toClass, array $context = []): object;
}

0 comments on commit 2ac9fe0

Please sign in to comment.