mirror of
https://github.com/danog/endtoend-test-psl.git
synced 2024-11-30 04:39:48 +01:00
[Json] use TypeInterface
This commit is contained in:
parent
2af0f628d3
commit
c34f75bcb2
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user