1 | <?php namespace Limoncello\Validation\Validator; |
||
34 | trait Generics |
||
35 | { |
||
36 | /** |
||
37 | * @param RuleInterface $first |
||
38 | * @param RuleInterface $second |
||
39 | * |
||
40 | * @return RuleInterface |
||
41 | */ |
||
42 | 1 | protected static function andX(RuleInterface $first, RuleInterface $second): RuleInterface |
|
46 | |||
47 | /** |
||
48 | * @param RuleInterface $primary |
||
49 | * @param RuleInterface $secondary |
||
50 | * |
||
51 | * @return RuleInterface |
||
52 | */ |
||
53 | 1 | protected static function orX(RuleInterface $primary, RuleInterface $secondary): RuleInterface |
|
57 | |||
58 | /** |
||
59 | * @param callable $condition |
||
60 | * @param RuleInterface $onTrue |
||
61 | * @param RuleInterface $onFalse |
||
62 | * @param array $settings |
||
63 | * |
||
64 | * @return RuleInterface |
||
65 | */ |
||
66 | 3 | protected static function ifX( |
|
74 | |||
75 | /** |
||
76 | * @return RuleInterface |
||
77 | */ |
||
78 | 10 | protected static function success(): RuleInterface |
|
82 | |||
83 | /** |
||
84 | * @param int $errorCode |
||
85 | * @param null|mixed $errorContext |
||
86 | * |
||
87 | * @return RuleInterface |
||
88 | */ |
||
89 | 3 | protected static function fail(int $errorCode = ErrorCodes::INVALID_VALUE, $errorContext = null): RuleInterface |
|
93 | |||
94 | /** |
||
95 | * @param mixed $value |
||
96 | * |
||
97 | * @return RuleInterface |
||
98 | */ |
||
99 | 1 | protected static function value($value): RuleInterface |
|
106 | |||
107 | /** |
||
108 | * @param array $values |
||
109 | * @param RuleInterface|null $next |
||
110 | * |
||
111 | * @return RuleInterface |
||
112 | */ |
||
113 | 1 | protected static function enum(array $values, RuleInterface $next = null): RuleInterface |
|
117 | |||
118 | /** |
||
119 | * @param int $filterId |
||
120 | * @param mixed $options |
||
121 | * @param int $errorCode |
||
122 | * @param RuleInterface|null $next |
||
123 | * |
||
124 | * @return RuleInterface |
||
125 | */ |
||
126 | 1 | protected static function filter( |
|
136 | |||
137 | /** |
||
138 | * @param RuleInterface $rule |
||
|
|||
139 | * |
||
140 | * @return RuleInterface |
||
141 | */ |
||
142 | 1 | protected static function required(RuleInterface $rule = null): RuleInterface |
|
146 | } |
||
147 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.