We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
1 | <?php |
||
33 | final class Factory |
||
34 | { |
||
35 | /** |
||
36 | * @var string[] |
||
37 | */ |
||
38 | private $namespaces; |
||
39 | |||
40 | /** |
||
41 | * @var ReflectionClass[] |
||
42 | */ |
||
43 | private $reflections; |
||
44 | |||
45 | /** |
||
46 | * @var Reader |
||
47 | */ |
||
48 | private $annotationReader; |
||
49 | |||
50 | /** |
||
51 | * @var self |
||
52 | */ |
||
53 | private static $defaultInstance; |
||
54 | |||
55 | /** |
||
56 | * Initializes the rule with the defined namespaces. |
||
57 | * |
||
58 | * If the default namespace is not in the array, it will be add to the end |
||
59 | * of the array. |
||
60 | * |
||
61 | * @param array $namespaces |
||
62 | */ |
||
63 | 11 | public function __construct(array $namespaces = []) |
|
75 | |||
76 | /** |
||
77 | * Defines the default instance of the factory. |
||
78 | * |
||
79 | * @param Factory $factory |
||
80 | */ |
||
81 | 1 | public static function setDefaultInstance(self $factory) |
|
85 | |||
86 | /** |
||
87 | * Returns the default instance of the factory. |
||
88 | * |
||
89 | * @return self |
||
90 | */ |
||
91 | 2 | public static function getDefaultInstance(): self |
|
99 | |||
100 | /** |
||
101 | * Returns a list of namespaces. |
||
102 | * |
||
103 | * @return array |
||
104 | */ |
||
105 | 9 | public function getNamespaces(): array |
|
109 | |||
110 | /** |
||
111 | * Creates a rule based on its name with the defined arguments. |
||
112 | * |
||
113 | * @param string $ruleName |
||
114 | * @param array $arguments |
||
115 | * |
||
116 | * @throws ComponentException When the rule cannot be created |
||
117 | * |
||
118 | * @return Rule |
||
119 | */ |
||
120 | 6 | public function rule(string $ruleName, array $arguments = []): Rule |
|
124 | |||
125 | public function exception(Result $result): ValidationException |
||
132 | |||
133 | public function message(Result $result, string $locale = 'en'): Message |
||
137 | |||
138 | public function messages(Result $result, string $locale = 'en'): array |
||
171 | |||
172 | private function createMessage(Result $result, string $locale = 'en'): Message |
||
190 | |||
191 | private function chooseTemplate(Templates $templates, bool $isInverted, string $templateId): Template |
||
208 | |||
209 | private function getRuleName(Rule $rule): string |
||
215 | |||
216 | /** |
||
217 | * Returns a reflection of a rule based on its name. |
||
218 | * |
||
219 | * @throws RuleNotFoundException |
||
220 | * |
||
221 | * @param string $ruleName |
||
222 | * |
||
223 | * @return ReflectionClass |
||
224 | */ |
||
225 | 6 | private function getRuleReflection(string $ruleName): ReflectionClass |
|
238 | |||
239 | /** |
||
240 | * Returns a reflection of an exception based on a rule name. |
||
241 | * |
||
242 | * @throws ExceptionNotFoundException |
||
243 | * |
||
244 | * @param string $ruleName |
||
245 | * |
||
246 | * @return ReflectionClass |
||
247 | */ |
||
248 | private function getExceptionReflection(string $ruleName): ReflectionClass |
||
261 | |||
262 | /** |
||
263 | * Creates a ReflectionClass object based on a class name. |
||
264 | * |
||
265 | * This method always return the same object for a given class name in order |
||
266 | * to improve performance. Also checks if the reflection is child of $parentClass |
||
267 | * and if it is instantiable. |
||
268 | * |
||
269 | * @param string $className |
||
270 | * @param string $parentClassName |
||
271 | * |
||
272 | * @return ReflectionClass |
||
273 | * |
||
274 | * @throws InvalidClassException When not valid. |
||
275 | */ |
||
276 | 5 | private function getReflection(string $className, string $parentClassName): ReflectionClass |
|
292 | } |
||
293 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..