Skip to content

Commit ca142a0

Browse files
mdeboerwouterj
authored andcommitted
Improve some PHPdocs based on existing Symfony stubs in PHPstan and Psalm
1 parent ab2ad88 commit ca142a0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

SerializerInterface.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,20 @@ interface SerializerInterface
1919
/**
2020
* Serializes data in the appropriate format.
2121
*
22-
* @param mixed $data Any data
23-
* @param string $format Format name
24-
* @param array $context Options normalizers/encoders have access to
22+
* @param array<string, mixed> $context Options normalizers/encoders have access to
2523
*/
2624
public function serialize(mixed $data, string $format, array $context = []): string;
2725

2826
/**
2927
* Deserializes data into the given type.
28+
*
29+
* @template TObject of object
30+
* @template TType of string|class-string<TObject>
31+
*
32+
* @param TType $type
33+
* @param array<string, mixed> $context
34+
*
35+
* @psalm-return (TType is class-string<TObject> ? TObject : mixed)
3036
*/
3137
public function deserialize(mixed $data, string $type, string $format, array $context = []): mixed;
3238
}

0 commit comments

Comments
 (0)