Issues (54)

src/HydratorInterface.php (3 issues)

1
<?php
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Nekhay <[email protected]>
7
 * @copyright Copyright (c) 2021, Anatoly Nekhay
8
 * @license https://github.com/sunrise-php/hydrator/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/hydrator
10
 */
11
12
declare(strict_types=1);
13
14
namespace Sunrise\Hydrator;
15
16
use Sunrise\Hydrator\Exception\InvalidDataException;
17
use Sunrise\Hydrator\Exception\InvalidObjectException;
18
use Sunrise\Hydrator\Exception\InvalidValueException;
19
20
interface HydratorInterface
21
{
22
    /**
23
     * Tries to cast the given value to the given type
24
     *
25
     * @param mixed $value
26
     * @param list<array-key> $path
0 ignored issues
show
The type Sunrise\Hydrator\list was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
27
     * @param array<string, mixed> $context
28
     *
29
     * @return mixed
30
     *
31
     * @throws InvalidObjectException
32
     * @throws InvalidValueException
33
     * @throws InvalidDataException
34
     *
35
     * @since 3.1.0
36
     */
37
    public function castValue($value, Type $type, array $path = [], array $context = []);
38
39
    /**
40
     * Hydrates the given object with the given data
41
     *
42
     * @param class-string<T>|T $object
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<T>|T at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<T>|T.
Loading history...
43
     * @param array<array-key, mixed> $data
44
     * @param list<array-key> $path
45
     * @param array<string, mixed> $context
46
     *
47
     * @return T
48
     *
49
     * @throws InvalidObjectException
50
     * @throws InvalidDataException
51
     *
52
     * @template T of object
53
     */
54
    public function hydrate($object, array $data, array $path = [], array $context = []): object;
55
56
    /**
57
     * Hydrates the given object with the given JSON
58
     *
59
     * @param class-string<T>|T $object
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<T>|T at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<T>|T.
Loading history...
60
     * @param int<0, max> $flags
61
     * @param int<1, 2147483647> $depth
62
     * @param list<array-key> $path
63
     * @param array<string, mixed> $context
64
     *
65
     * @return T
66
     *
67
     * @throws InvalidObjectException
68
     * @throws InvalidDataException
69
     *
70
     * @template T of object
71
     */
72
    // phpcs:ignore Generic.Files.LineLength
73
    public function hydrateWithJson($object, string $json, int $flags = 0, int $depth = 512, array $path = [], array $context = []): object;
74
}
75