recaptcha icon indicating copy to clipboard operation
recaptcha copied to clipboard

PHP 8.4 deprecation

Open garak opened this issue 11 months ago • 3 comments

  1. /my_project/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php:139 ReCaptcha\ReCaptcha::__construct(): Implicitly marking parameter $requestMethod as nullable is deprecated, the explicit nullable type must be used instead

The $requestMethod argument should accept null as value. The following change should be applied

diff --git a/src/ReCaptcha/ReCaptcha.php b/src/ReCaptcha/ReCaptcha.php
index d75ce1f..b928fc8 100644
--- a/src/ReCaptcha/ReCaptcha.php
+++ b/src/ReCaptcha/ReCaptcha.php
@@ -136,7 +136,7 @@ class ReCaptcha
      * @param RequestMethod $requestMethod method used to send the request. Defaults to POST.
      * @throws \RuntimeException if $secret is invalid
      */
-    public function __construct($secret, RequestMethod $requestMethod = null)
+    public function __construct($secret, ?RequestMethod $requestMethod = null)
     {
         if (empty($secret)) {
             throw new \RuntimeException('No secret provided');

I can propose a PR.

garak avatar Nov 22 '24 17:11 garak