@@ -60,7 +60,7 @@ class IsTrueValidator extends ConstraintValidator
6060 *
6161 * @var array
6262 */
63- protected $ trusted_roles ;
63+ protected $ trustedRoles ;
6464
6565 /**
6666 * The reCAPTCHA verify server URL.
@@ -76,7 +76,7 @@ class IsTrueValidator extends ConstraintValidator
7676 * @param array $httpProxy
7777 * @param bool $verifyHost
7878 * @param AuthorizationCheckerInterface|null $authorizationChecker
79- * @param array $trusted_roles
79+ * @param array $trustedRoles
8080 * @param string $apiHost
8181 */
8282 public function __construct (
@@ -86,7 +86,7 @@ public function __construct(
8686 array $ httpProxy ,
8787 $ verifyHost ,
8888 AuthorizationCheckerInterface $ authorizationChecker = null ,
89- array $ trusted_roles = array (),
89+ array $ trustedRoles = array (),
9090 $ apiHost = 'www.google.com ' )
9191 {
9292 $ this ->enabled = $ enabled ;
@@ -95,7 +95,7 @@ public function __construct(
9595 $ this ->httpProxy = $ httpProxy ;
9696 $ this ->verifyHost = $ verifyHost ;
9797 $ this ->authorizationChecker = $ authorizationChecker ;
98- $ this ->trusted_roles = $ trusted_roles ;
98+ $ this ->trustedRoles = $ trustedRoles ;
9999 $ this ->recaptchaVerifyServer = 'https:// ' .$ apiHost ;
100100 }
101101
@@ -110,7 +110,9 @@ public function validate($value, Constraint $constraint)
110110 }
111111
112112 // if we have an authorized role
113- if ($ this ->authorizationChecker && $ this ->authorizationChecker ->isGranted ($ this ->trusted_roles )) {
113+ if ($ this ->authorizationChecker
114+ && count ($ this ->trustedRoles ) > 0
115+ && $ this ->authorizationChecker ->isGranted ($ this ->trustedRoles )) {
114116 return ;
115117 }
116118
0 commit comments