[Json] use TypeInterface

This commit is contained in:
azjezz 2021-02-21 05:00:33 +01:00 committed by Saif Eddin Gmati
parent 2af0f628d3
commit c34f75bcb2

View File

@ -6,20 +6,20 @@ namespace Psl\Json;
use Psl\Type\Exception\AssertException; use Psl\Type\Exception\AssertException;
use Psl\Type\Exception\CoercionException; use Psl\Type\Exception\CoercionException;
use Psl\Type\Type; use Psl\Type\TypeInterface;
/** /**
* Decode a json encoded string into a dynamic variable. * Decode a json encoded string into a dynamic variable.
* *
* @psalm-template T * @psalm-template T
* *
* @psalm-param Type<T> $type * @psalm-param TypeInterface<T> $type
* *
* @psalm-return T * @psalm-return T
* *
* @throws Exception\DecodeException If an error occurred. * @throws Exception\DecodeException If an error occurred.
*/ */
function typed(string $json, Type $type) function typed(string $json, TypeInterface $type)
{ {
$value = decode($json); $value = decode($json);