1 | <?php |
||
11 | abstract class BaseValidator extends AbstractValidator |
||
12 | { |
||
13 | /** |
||
14 | * Validator |
||
15 | * |
||
16 | * @var \Illuminate\Validation\Factory |
||
17 | */ |
||
18 | protected $validator; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $keyName; |
||
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $messages = []; |
||
29 | |||
30 | /** |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $attributes = []; |
||
34 | |||
35 | /** |
||
36 | * Construct |
||
37 | * |
||
38 | * @param \Illuminate\Validation\Factory $validator |
||
39 | */ |
||
40 | 3 | public function __construct(Factory $validator) |
|
47 | |||
48 | /** |
||
49 | * MakeRules |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | 3 | protected function makeRules() |
|
57 | |||
58 | /** |
||
59 | * Make Messages |
||
60 | * |
||
61 | * @return array |
||
62 | */ |
||
63 | 3 | protected function makeMessages() |
|
67 | |||
68 | /** |
||
69 | * Make Attributes |
||
70 | * |
||
71 | * @return array |
||
72 | */ |
||
73 | 3 | protected function makeAttributes() |
|
77 | |||
78 | /** |
||
79 | * Get Messages |
||
80 | * |
||
81 | * @param array $messages |
||
|
|||
82 | * |
||
83 | * @return array |
||
84 | */ |
||
85 | 3 | public function getMessages() |
|
89 | |||
90 | /** |
||
91 | * Get Attributes |
||
92 | * |
||
93 | * @param array $attributes |
||
94 | * |
||
95 | * @return array |
||
96 | */ |
||
97 | 3 | public function getAttributes() |
|
101 | |||
102 | /** |
||
103 | * Get Validator |
||
104 | * |
||
105 | * @return \Illuminate\Validation\Factory |
||
106 | */ |
||
107 | 1 | public function getValidator() |
|
111 | |||
112 | /** |
||
113 | * Set Key Name |
||
114 | * |
||
115 | * @param string $keyName |
||
116 | * |
||
117 | * @return BaseValidator |
||
118 | */ |
||
119 | 1 | public function setKeyName($keyName) |
|
123 | |||
124 | /** |
||
125 | * Get rule for validation by action ValidatorInterface::RULE_CREATE or ValidatorInterface::RULE_UPDATE |
||
126 | * |
||
127 | * Default rule: ValidatorInterface::RULE_CREATE |
||
128 | * |
||
129 | * @param string|null $action |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | 3 | public function getRules($action = null) |
|
143 | |||
144 | /** |
||
145 | * Pass the data and the rules to the validator |
||
146 | * |
||
147 | * @param string $action |
||
148 | * @return bool |
||
149 | */ |
||
150 | 2 | public function passes($action = null) |
|
164 | |||
165 | /** |
||
166 | * Parser Validation Rules |
||
167 | * |
||
168 | * @param array $rules |
||
169 | * @param int|null $id |
||
170 | * |
||
171 | * @return array |
||
172 | */ |
||
173 | 3 | protected function parserValidationRules($rules, $id = null) |
|
223 | |||
224 | /** |
||
225 | * Get the value of a given attribute. |
||
226 | * |
||
227 | * @param string $attribute |
||
228 | * @return mixed |
||
229 | */ |
||
230 | 1 | protected function getValue($attribute) |
|
236 | } |
||
237 |
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.