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

draft: Add RecaptchaServiceInterface #34

Open
wants to merge 4 commits into
base: 3.8.x
Choose a base branch
from

Conversation

earthiverse
Copy link

@earthiverse earthiverse commented Jan 15, 2024

Q A
Documentation no
Bugfix no
BC Break probably no (someone please verify)
New Feature no
RFC yes
QA no

Description

laminas-captcha@2.17 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-captcha

I'm not sure about laminas's best practices, let me know if there are things that need fixing.

Signed-off-by: Kent Rasmussen <hyprkookeez@gmail.com>
Signed-off-by: Kent Rasmussen <hyprkookeez@gmail.com>
@earthiverse
Copy link
Author

@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.

Copy link
Member

@gsteel gsteel left a 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/ReCaptcha.php Outdated Show resolved Hide resolved
src/ReCaptcha.php Outdated Show resolved Hide resolved
src/ReCaptcha.php Outdated Show resolved Hide resolved
src/ReCaptcha.php Outdated Show resolved Hide resolved
src/ReCaptcha.php Outdated Show resolved Hide resolved
src/ReCaptcha.php Outdated Show resolved Hide resolved
/**
* An interface for interacting with a recaptcha service provider
*/
interface RecaptchaServiceInterface
Copy link
Member

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.

Copy link
Author

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 :)

Signed-off-by: Kent Rasmussen <hyprkookeez@gmail.com>
Signed-off-by: Kent Rasmussen <hyprkookeez@gmail.com>
@earthiverse earthiverse marked this pull request as ready for review February 27, 2024 01:19
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

Successfully merging this pull request may close these issues.

2 participants