excelwebzone / EWZRecaptchaBundle

This bundle provides easy reCAPTCHA form field for Symfony.
MIT License
396 stars 160 forks source link

Unable to use @Recapchta\IsTrueV3 annotation #269

Closed Martin1982 closed 3 years ago

Martin1982 commented 3 years ago

When adding

    /**
     * @Recaptcha\IsTrueV3
     **/

The cache:clear command on Symfony 4.4 / PHP 7.4 gave an error;

[Semantical Error] The class "EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrueV3" is not annotated with @Annotation.                                             
  Are you sure this class can be used as annotation?                                                                                                                      
  If so, then you need to add @Annotation to the _class_ doc comment of "EWZ\Bundle\RecaptchaBundle\Validator\Constraints\IsTrueV3".                                      
  If it is indeed no annotation, then you need to add @IgnoreAnnotation("Recaptcha\IsTrueV3") to the _class_ doc comment of property App\Entity\Comment::$recaptcha. 

Adding the annotation to the class fixes this error

ikvasnica commented 3 years ago

We have the same issue (PHP 8, Symfony 5.2.6). Everything works when the validation constraint is added directly to the form class.

arirangz commented 3 years ago

Hello @excelwebzone ,

Why this issue is closed?

@ikvasnica gave a work around but it's not fixing the original issue.

Thanks

Martin1982 commented 3 years ago

Hello @excelwebzone ,

Why this issue is closed?

@ikvasnica gave a work around but it's not fixing the original issue.

Thanks

The fix has been merged in https://github.com/excelwebzone/EWZRecaptchaBundle/commit/88646b56877007fd86e50438ddf1e29ee0905d32

arirangz commented 3 years ago

thanks @Martin1982 for your fast answer.

We are using 1.5.26 as per our requirement (php 5.6).

Do you think you could also merge it into this version?

Thanks

Martin1982 commented 3 years ago

@arirangz v1.5.29 should be backwards compatible according to semantic versioning conventions. So why not just run composer update on your project to update to the latest?

Upgrading patch versions is almost always a good idea when Semver is respected;

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards compatible manner, and PATCH version when you make backwards compatible bug fixes. Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

arirangz commented 3 years ago

@arirangz v1.5.29 requires php ^7.1 Actually I installed the bundle yesterday and it installed v1.5.26

So do you think I can force to install v1.5.29?

Thanks

Martin1982 commented 3 years ago

@arirangz That indeed looks like a BC break, since I only contributed for this patch this is possibly a new issue which needs to be reviewed by @excelwebzone

What I can suggest to help you forward is;

  1. Fork this repository
  2. Add the required PHP version to composer.json
  3. Use your fork while the issue is still pending (https://matthewsetter.com/series/tooling/composer/forked-repositories/)
  4. Create a PR from your fork since it solves the issue
  5. Welcome to the contributors family!