1 | <?php |
||
10 | abstract class CustomRule implements Rule |
||
11 | { |
||
12 | /** |
||
13 | * The current validator instance. |
||
14 | * |
||
15 | * @var \Illuminate\Contracts\Validation\Validator |
||
16 | */ |
||
17 | protected static $validator; |
||
18 | |||
19 | /** |
||
20 | * The current FormRequest instance. |
||
21 | * |
||
22 | * @var \Illuminate\Http\Request |
||
23 | */ |
||
24 | protected static $request; |
||
25 | |||
26 | /** |
||
27 | * The current ValidationService instance. |
||
28 | * |
||
29 | * @var \PerfectOblivion\Valid\ValidationService\ValidationService |
||
30 | */ |
||
31 | protected static $service; |
||
32 | |||
33 | /** |
||
34 | * Set the validator property. |
||
35 | * |
||
36 | * @param \Illuminate\Contracts\Validation\Validator $validator |
||
37 | */ |
||
38 | public static function validator(?Validator $validator = null) |
||
46 | |||
47 | /** |
||
48 | * Set the request property. |
||
49 | * |
||
50 | * @param \Illuminate\Http\Request $request |
||
51 | */ |
||
52 | public static function request(?Request $request = null) |
||
60 | |||
61 | /** |
||
62 | * Set the Validation Service property. |
||
63 | * |
||
64 | * @param \PerfectOblivion\Valid\Contracts\ValidationService\ValidationService $service |
||
65 | */ |
||
66 | public static function service(? ValidationService $service = null) |
||
74 | |||
75 | /** |
||
76 | * Determine if the validation rule passes. |
||
77 | * |
||
78 | * @param string $attribute |
||
79 | * @param mixed $value |
||
80 | * |
||
81 | * @return bool |
||
82 | */ |
||
83 | abstract public function passes($attribute, $value); |
||
84 | |||
85 | /** |
||
86 | * Get the validation error message. |
||
87 | * |
||
88 | * @return string |
||
89 | */ |
||
90 | abstract public function message(); |
||
91 | |||
92 | /** |
||
93 | * Handle property accessibility for CustomRule. |
||
94 | * |
||
95 | * @param string $property |
||
96 | * |
||
97 | * @return mixed |
||
98 | */ |
||
99 | public function __get($property) |
||
107 | } |
||
108 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.