1 | <?php |
||
13 | abstract class BaseValidator extends AbstractValidator |
||
14 | { |
||
15 | /** |
||
16 | * Validator |
||
17 | * |
||
18 | * @var \Illuminate\Validation\Factory |
||
19 | */ |
||
20 | protected $validator; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $keyName; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $messages = []; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | protected $attributes = []; |
||
36 | |||
37 | /** |
||
38 | * Construct |
||
39 | * |
||
40 | * @param \Illuminate\Validation\Factory $validator |
||
41 | */ |
||
42 | 3 | public function __construct(Factory $validator) |
|
49 | |||
50 | /** |
||
51 | * MakeRules |
||
52 | * |
||
53 | * @return array |
||
54 | */ |
||
55 | 3 | protected function makeRules() |
|
59 | |||
60 | /** |
||
61 | * Make Messages |
||
62 | * |
||
63 | * @return array |
||
64 | */ |
||
65 | 3 | protected function makeMessages() |
|
69 | |||
70 | /** |
||
71 | * Make Attributes |
||
72 | * |
||
73 | * @return array |
||
74 | */ |
||
75 | 3 | protected function makeAttributes() |
|
79 | |||
80 | /** |
||
81 | * Get Messages |
||
82 | * |
||
83 | * @param array $messages |
||
|
|||
84 | * |
||
85 | * @return array |
||
86 | */ |
||
87 | 3 | public function getMessages() |
|
91 | |||
92 | /** |
||
93 | * Get Attributes |
||
94 | * |
||
95 | * @param array $attributes |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | 3 | public function getAttributes() |
|
103 | |||
104 | /** |
||
105 | * Get Validator |
||
106 | * |
||
107 | * @return \Illuminate\Validation\Factory |
||
108 | */ |
||
109 | 1 | public function getValidator() |
|
113 | |||
114 | /** |
||
115 | * Set Key Name |
||
116 | * |
||
117 | * @param string $keyName |
||
118 | * |
||
119 | * @return BaseValidator |
||
120 | */ |
||
121 | 1 | public function setKeyName($keyName) |
|
125 | |||
126 | /** |
||
127 | * Get rule for validation by action ValidatorInterface::RULE_CREATE or ValidatorInterface::RULE_UPDATE |
||
128 | * |
||
129 | * Default rule: ValidatorInterface::RULE_CREATE |
||
130 | * |
||
131 | * @param string|null $action |
||
132 | * |
||
133 | * @return array |
||
134 | */ |
||
135 | 3 | public function getRules($action = null) |
|
145 | |||
146 | /** |
||
147 | * Pass the data and the rules to the validator |
||
148 | * |
||
149 | * @param string $action |
||
150 | * @return bool |
||
151 | */ |
||
152 | 2 | public function passes($action = null) |
|
166 | |||
167 | /** |
||
168 | * Parser Validation Rules |
||
169 | * |
||
170 | * @param array $rules |
||
171 | * @param int|null $id |
||
172 | * |
||
173 | * @return array |
||
174 | */ |
||
175 | 3 | protected function parserValidationRules($rules, $id = null) |
|
242 | |||
243 | 1 | protected function replaceValuesRules($rule) |
|
253 | |||
254 | /** |
||
255 | * Get the value of a given attribute. |
||
256 | * |
||
257 | * @param string $attribute |
||
258 | * |
||
259 | * @return mixed |
||
260 | */ |
||
261 | 1 | protected function getValue($attribute) |
|
269 | } |
||
270 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.