Issues (5)

src/Context.php (1 issue)

1
<?php
2
/**
3
 * Schema Validator
4
 *
5
 * @author Vlad Shashkov <[email protected]>
6
 * @copyright Copyright (c) 2021, The Myaza Software
7
 */
8
9
declare(strict_types=1);
10
11
namespace SchemaValidator;
12
13
use Symfony\Component\Validator\Context\ExecutionContextInterface;
14
15
/**
16
 * @codeCoverageIgnore
17
 */
18
final class Context
19
{
20
    public function __construct(
21
        private string $rootPath,
22
        private string $rootType,
23
        private bool $strictTypes,
24
        private ExecutionContextInterface $execution,
25
    ) {
26
    }
27
28
    public function getRootPath(): string
29
    {
30
        return $this->rootPath;
31
    }
32
33
    public function getExecution(): ExecutionContextInterface
34
    {
35
        return $this->execution;
36
    }
37
38
    /**
39
     * @return class-string|string
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string|string at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string|string.
Loading history...
40
     */
41
    public function getRootType(): string
42
    {
43
        return $this->rootType;
44
    }
45
46
    public function withExecution(ExecutionContextInterface $execution): self
47
    {
48
        $new            = clone $this;
49
        $new->execution = $execution;
50
51
        return $new;
52
    }
53
54
    public function isStrictTypes(): bool
55
    {
56
        return $this->strictTypes;
57
    }
58
}
59