Conditions | 2 |
Paths | 2 |
Total Lines | 14 |
Code Lines | 9 |
Lines | 14 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
42 | View Code Duplication | public static function valid($data) |
|
43 | { |
||
44 | $rules = [ |
||
45 | 'body' => 'required|min:3', |
||
46 | 'post_id' => 'required|min:1|integer|exists:forum_posts,id', |
||
47 | 'author_id' => 'required|min:1|integer|exists:users,id' |
||
48 | ]; |
||
49 | $validator = Validator::make($data, $rules); |
||
50 | |||
51 | if ($validator->passes()) { |
||
52 | return true; |
||
53 | } |
||
54 | return false; |
||
55 | } |
||
56 | |||
67 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.