I noticed that the following error is produced when checking for coding standard violations:

phpcs --standard=Drupal .

FILE: /var/www/html/drupal2/modules/custom/social_auth_paypal/src/Plugin/Network/PaypalAuth.php
-----------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
-----------------------------------------------------------------------------------------------
 37 | ERROR | [x] Data types in @throws tags need to be fully namespaced
-----------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------

Time: 155ms; Memory: 8MB
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

neel24 created an issue. See original summary.

neel24’s picture

I've added a patch to fix the error.

neel24’s picture

Status: Active » Needs review
gvso’s picture

Status: Needs review » Needs work

Opps. It seems like I included this change in #3013252: "Paypal" should be "PayPal". However, drupal coding practice throws

FILE: /var/www/drupal_projects/drupal_dev/modules/social_auth_paypal/src/PayPalAuthManager.php
---------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------------------------------------------
 33 | ERROR | The $_GET super global must not be accessed directly; inject the request.stack service and use
    |       | $stack->getCurrentRequest()->query->get('code') instead
---------------------------------------------------------------------------------------------------------------------------------------

Time: 127ms; Memory: 6MB

We should fix that! See Social Auth Google for an example!

neel24’s picture

Hmm, I cross-checked with Social Auth Google, and it seems that it also returns the same error:

phpcs --standard=DrupalPractice .

FILE: /var/www/html/drupal2/modules/social_auth_google/src/GoogleAuthManager.php
----------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------
 36 | ERROR | The $_GET super global must not be accessed directly; inject the request.stack
    |       | service and use $stack->getCurrentRequest()->query->get('code') instead
----------------------------------------------------------------------------------------------------

Time: 86ms; Memory: 6MB
gvso’s picture

My bad. I thought it was fixed there. Ok, basically, you wanna inject the current request service into the constructor of that class. Then, you want to let Drupal know by adding it as a dependency in the .services.yml file. Let me know if you have any questions!

neel24’s picture

Status: Needs work » Needs review
StatusFileSize
new2.25 KB

Alright, so I had a look at Social Auth Heroku for ref and I've made some changes to fix the error.

neel24’s picture

Sorry, had forgotten to remove var_dump. Attaching new patch.

agrochal’s picture

Status: Needs review » Needs work

You use the wrong way to implement request service inside construct function, check this issue: https://www.drupal.org/project/social_auth_google/issues/3109038

neel24’s picture

Status: Needs work » Needs review
StatusFileSize
new2.17 KB

My bad, the OAuth2Manager in Social Api had been updated and I was still using an older version, hence that's why the previous request was still working for me. I've updated the patch to fix the coding standards and updated the request.

samir_shukla made their first commit to this issue’s fork.

avpaderno’s picture

Issue tags: +Coding standards
roberttabigue’s picture

Status: Needs review » Needs work
StatusFileSize
new142.82 KB

Hi @neel24,

Your patch#10 is not working on the 'Social Auth PayPal' module against 8.x-2.x-dev on my D10 site.

I ran this command on the module:
curl https://www.drupal.org/files/issues/2020-01-29/social_auth_paypal-fix-coding-standards-3101051-10.patch | git apply -v

Please see the attached file for reference.

I'm moving this to ‘Needs work’ for now.

Thank you!

avpaderno’s picture

Let's use a merge request, now that patches are no longer tested.

avpaderno’s picture

Issue tags: +Needs reroll
nilesh.addweb’s picture

Assigned: Unassigned » nilesh.addweb

nilesh.addweb’s picture

Assigned: nilesh.addweb » Unassigned
Status: Needs work » Needs review
riddhi.addweb’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new91.38 KB

I have applied the MR !1 and it resolves the issues.
Please check the screenshot for the same.

avpaderno’s picture

Issue tags: -Needs reroll