Issues (39)

src/Normalizer/NormalizerInterface.php (1 issue)

1
<?php
2
3
namespace Bdf\Serializer\Normalizer;
4
5
use Bdf\Serializer\Context\DenormalizationContext;
6
use Bdf\Serializer\Context\NormalizationContext;
7
use Bdf\Serializer\Type\Type;
8
9
/**
10
 * Interface NormalizerInterface
11
 *
12
 * @template T
13
 */
14
interface NormalizerInterface
15
{
16
    /**
17
     * Normalize data
18
     *
19
     * @param T $data
20
     * @param NormalizationContext $context
21
     *
22
     * @return mixed
23
     */
24
    public function normalize($data, NormalizationContext $context);
25
26
    /**
27
     * Denormalize data
28
     *
29
     * @param mixed $data
30
     * @param Type<T> $type
31
     * @param DenormalizationContext $context
32
     *
33
     * @return T
34
     */
35
    public function denormalize($data, Type $type, DenormalizationContext $context);
36
37
    /**
38
     * Check whether the normalizer support the class name
39
     *
40
     * @param class-string $className
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string.
Loading history...
41
     *
42
     * @return boolean
43
     * @psalm-assert-if-true T $className
44
     */
45
    public function supports(string $className): bool;
46
}
47