| 1 | <?php  | 
            ||
| 8 | class CaptchaMiddleware  | 
            ||
| 9 | { | 
            ||
| 10 | |||
| 11 | /**  | 
            ||
| 12 | * @var Factory  | 
            ||
| 13 | */  | 
            ||
| 14 | protected $validator;  | 
            ||
| 15 | |||
| 16 | /**  | 
            ||
| 17 | * CaptchaMiddleware constructor.  | 
            ||
| 18 | *  | 
            ||
| 19 | * @param Factory $validator  | 
            ||
| 20 | */  | 
            ||
| 21 | public function __construct(Factory $validator)  | 
            ||
| 25 | |||
| 26 | /**  | 
            ||
| 27 | * @param $request  | 
            ||
| 28 | * @param Closure $next  | 
            ||
| 29 | * @param string $captchaKey  | 
            ||
| 30 | * @return mixed  | 
            ||
| 31 | */  | 
            ||
| 32 | public function handle($request, Closure $next, $captchaKey = 'captcha')  | 
            ||
| 38 | |||
| 39 | /**  | 
            ||
| 40 | * 验证  | 
            ||
| 41 | *  | 
            ||
| 42 | * @param $request  | 
            ||
| 43 | * @param $captchaKey  | 
            ||
| 44 | */  | 
            ||
| 45 | protected function validate($request, $captchaKey)  | 
            ||
| 53 | |||
| 54 | /**  | 
            ||
| 55 | * 验证规则  | 
            ||
| 56 | *  | 
            ||
| 57 | * @param string $captchaKey  | 
            ||
| 58 | * @return array  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 59 | */  | 
            ||
| 60 | protected function rules($captchaKey)  | 
            ||
| 66 | |||
| 67 | /**  | 
            ||
| 68 | * 验证的错误消息  | 
            ||
| 69 | *  | 
            ||
| 70 | * @param string $captchaKey  | 
            ||
| 71 | * @return array  | 
            ||
| 72 | */  | 
            ||
| 73 | protected function message($captchaKey)  | 
            ||
| 77 | }  | 
            ||
| 78 | 
This check looks for the generic type
arrayas a return type and suggests a more specific type. This type is inferred from the actual code.