fix: improve type definitions to allow Psalm automatic inferring

This commit is contained in:
Marco Pivetta 2022-01-11 16:21:31 +01:00 committed by Romain Canon
parent 7a49f45175
commit f9b04c5c27

View File

@ -8,11 +8,18 @@ namespace CuyZ\Valinor\Mapper;
interface TreeMapper
{
/**
* @template T of object
* @psalm-template TObject of object
* @psalm-template TypeDefinition of string|class-string<TObject>
*
* @param string|class-string<T> $signature
* @param TypeDefinition $signature
* @param mixed $source
* @return T|mixed
* @return TObject|mixed
*
* @psalm-return (
* $signature is class-string<TObject>
* ? TObject
* : mixed
* )
*
* @throws MappingError
*/