1 | <?php namespace Limoncello\Validation\Validator; |
||
33 | trait Generics |
||
34 | { |
||
35 | /** |
||
36 | * @param RuleInterface $first |
||
37 | * @param RuleInterface $second |
||
38 | * |
||
39 | * @return RuleInterface |
||
40 | */ |
||
41 | 1 | protected static function andX(RuleInterface $first, RuleInterface $second): RuleInterface |
|
45 | |||
46 | /** |
||
47 | * @param RuleInterface $primary |
||
48 | * @param RuleInterface $secondary |
||
49 | * |
||
50 | * @return RuleInterface |
||
51 | */ |
||
52 | 1 | protected static function orX(RuleInterface $primary, RuleInterface $secondary): RuleInterface |
|
56 | |||
57 | /** |
||
58 | * @param callable $condition |
||
59 | * @param RuleInterface $onTrue |
||
60 | * @param RuleInterface $onFalse |
||
61 | * @param array $settings |
||
62 | * |
||
63 | * @return RuleInterface |
||
64 | */ |
||
65 | 2 | protected static function ifX( |
|
73 | |||
74 | /** |
||
75 | * @return RuleInterface |
||
76 | */ |
||
77 | 10 | protected static function success(): RuleInterface |
|
81 | |||
82 | /** |
||
83 | * @param int $errorCode |
||
84 | * @param null|mixed $errorContext |
||
85 | * |
||
86 | * @return RuleInterface |
||
87 | */ |
||
88 | 3 | protected static function fail(int $errorCode = ErrorCodes::INVALID_VALUE, $errorContext = null): RuleInterface |
|
92 | |||
93 | /** |
||
94 | * @param array $values |
||
95 | * @param RuleInterface|null $next |
||
96 | * |
||
97 | * @return RuleInterface |
||
98 | */ |
||
99 | 1 | protected static function enum(array $values, RuleInterface $next = null): RuleInterface |
|
103 | |||
104 | /** |
||
105 | * @param int $filterId |
||
106 | * @param mixed $options |
||
107 | * @param RuleInterface|null $next |
||
108 | * |
||
109 | * @return RuleInterface |
||
110 | */ |
||
111 | 1 | protected static function filter(int $filterId, $options = null, RuleInterface $next = null): RuleInterface |
|
116 | |||
117 | /** |
||
118 | * @param RuleInterface $rule |
||
|
|||
119 | * |
||
120 | * @return RuleInterface |
||
121 | */ |
||
122 | 1 | protected static function required(RuleInterface $rule = null): RuleInterface |
|
126 | } |
||
127 |
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.