1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Construction;
6
7use JMS\Serializer\DeserializationContext;
8use JMS\Serializer\Metadata\ClassMetadata;
9use JMS\Serializer\Visitor\DeserializationVisitorInterface;
10
11/**
12 * Implementations of this interface construct new objects during deserialization.
13 *
14 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
15 */
16interface ObjectConstructorInterface
17{
18    /**
19     * Constructs a new object.
20     *
21     * Implementations could for example create a new object calling "new", use
22     * "unserialize" techniques, reflection, or other means.
23     *
24     * @param mixed $data
25     * @param array $type ["name" => string, "params" => array]
26     */
27    public function construct(DeserializationVisitorInterface $visitor, ClassMetadata $metadata, $data, array $type, DeserializationContext $context): ?object;
28}
29