Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 deprecation #565

Open
garak opened this issue Nov 22, 2024 · 3 comments
Open

PHP 8.4 deprecation #565

garak opened this issue Nov 22, 2024 · 3 comments

Comments

@garak
Copy link

garak commented Nov 22, 2024

  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.

@lxregistry
Copy link

Deprecated: ReCaptcha\RequestMethod\CurlPost::__construct(): Implicitly marking parameter $curl as nullable is deprecated, the explicit nullable type must be used instead in /var/www/vhosts/domain.local/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php on line 66

@cnizzardini
Copy link

cnizzardini commented Dec 11, 2024

Being addressed here: #563

@phpfui
Copy link

phpfui commented Jan 9, 2025

Looks like this project is no longer being supported by google. If you want a PHP 8.4 compatible library, check out:

phpfui/recaptcha

Should be a drop in replacement. Let me know of any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants