1 | <?php |
||
22 | class Validator |
||
23 | { |
||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | public const RAILT_SDL_1_2 = __DIR__ . '/../../resources/rlsdl-1.2.json'; |
||
28 | |||
29 | /** |
||
30 | * @var string |
||
31 | */ |
||
32 | protected const DEFAULT_VERSION = self::RAILT_SDL_1_2; |
||
33 | |||
34 | /** |
||
35 | * @var JsonSchema |
||
36 | */ |
||
37 | private $validator; |
||
38 | |||
39 | /** |
||
40 | * @var array|object |
||
41 | */ |
||
42 | private $schema; |
||
43 | |||
44 | /** |
||
45 | * Validator constructor. |
||
46 | * @param Readable|null $schema |
||
47 | */ |
||
48 | public function __construct(Readable $schema = null) |
||
53 | |||
54 | /** |
||
55 | * @param null|Readable|File $schema |
||
56 | * @return mixed|array|object |
||
57 | */ |
||
58 | private function loadJsonSchema(?Readable $schema) |
||
64 | |||
65 | /** |
||
66 | * @param Definition $definition |
||
67 | * @return Definition |
||
68 | * @throws InternalException |
||
69 | */ |
||
70 | public function validate(Definition $definition): Definition |
||
88 | |||
89 | /** |
||
90 | * @param array $errors |
||
91 | * @return string |
||
92 | */ |
||
93 | private function errorsToString(array $errors): string |
||
105 | } |
||
106 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: