-
-
Notifications
You must be signed in to change notification settings - Fork 11
Add RecaptchaServiceInterface #34
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
base: 3.8.x
Are you sure you want to change the base?
Conversation
Signed-off-by: Kent Rasmussen <[email protected]>
Signed-off-by: Kent Rasmussen <[email protected]>
|
@Ocramius Sorry for the ping, but is there any chance you can take a look at this and laminas/laminas-captcha#32, or point me to someone who can? This is one of the things preventing us from migrating to PHP 8.2. |
gsteel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @earthiverse - Thank you for the contributions! There are a number of BC breaks here. If your plan is to get the interface released in the 3.x series, it'll have to drop all the native types.
src/RecaptchaServiceInterface.php
Outdated
| /** | ||
| * An interface for interacting with a recaptcha service provider | ||
| */ | ||
| interface RecaptchaServiceInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not necessary to add all of the methods present in the concrete class to the interface.
Probably, the only methods required here are verify and possibly getSiteKey as this may be needed for output in the markup/javascript.
Again, using parameter and return types here will force BC breaking changes on the existing concrete class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review!
laminas-captcha has calls to all of the functions in the interface, I think because it can create the service by itself if the options are provided.
I'll remove the types as a start :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
laminas-captchahas calls to all of the functions in the interface…
The implementations on both sides (recaptcha and captcha) are not future-proof but with the current suggestions for an interface we also nail down all the unnecessary methods. The interface would then have to be changed again with the next major update. This cannot be the goal.
Signed-off-by: Kent Rasmussen <[email protected]>
Signed-off-by: Kent Rasmussen <[email protected]>
Description
[email protected]uses a class marked as final for the service. Making an interface will also allow an easier pathway to adding Recaptcha V3 support. See the related merge request on laminas-captchaI'm not sure about laminas's best practices, let me know if there are things that need fixing.