Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
165 stars 67 forks source link

Fix WooCommerce hook comment phpcs reports #8437

Open reykjalin opened 3 months ago

reykjalin commented 3 months ago

Description

This is a follow up to https://github.com/Automattic/woocommerce-payments/pull/8415 where there are some issues reported by phpcs that were not a straight-forward fix.

Running

./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep '.php$') --sniffs='WooCommerce.Commenting.CommentHooks'
Results in a list of issues in these files (also a command to get just the list of files) ```sh ./vendor/bin/phpcs --standard=phpcs.xml.dist $(git ls-files | grep '.php$') --sniffs='WooCommerce.Commenting.CommentHooks' | rg 'FILE' | sed 's/FILE: \/path\/to\/wcpay\/repo\/parent\/woocommerce-payments\//* ' ``` * `templates/emails/plain/customer-ipp-receipt.php` * `tests/unit/core/server/request/test-class-core-create-and-confirm-intention-request.php` * `tests/unit/woopay/services/test-checkout-service.php` * `src/Internal/Proxy/HooksProxy.php` * `tests/unit/core/server/request/test-class-core-create-intention-request.php` * `includes/class-wc-payments-checkout.php` * `tests/unit/admin/test-class-wc-payments-admin-sections-overwrite.php` * `includes/multi-currency/CurrencySwitcherWidget.php` * `includes/express-checkout/class-wc-payments-express-checkout-button-helper.php` * `includes/class-wc-payments-dependency-service.php` * `tests/unit/core/server/request/test-class-core-request.php` * `includes/class-wc-payments-features.php` * `includes/admin/class-wc-rest-payments-settings-controller.php` * `includes/multi-currency/Geolocation.php` * `tests/unit/helpers/class-wc-helper-deposit-product-manager.php` * `src/Internal/Payment/Router.php` * `includes/multi-currency/Analytics.php` * `src/Internal/Service/OrderService.php` * `includes/class-wc-payments-fraud-service.php` * `tests/unit/core/server/request/test-class-get-request.php` * `templates/emails/customer-ipp-receipt.php` * `includes/multi-currency/Compatibility.php` * `tests/unit/src/Internal/Proxy/HooksProxyTest.php` * `tests/unit/helpers/class-wc-helper-product.php` * `includes/core/class-mode.php` * `includes/multi-currency/Compatibility/WooCommerceProductAddOns.php` * `tests/unit/multi-currency/compatibility/test-class-woocommerce-subscriptions.php` * `includes/class-database-cache.php` * `includes/core/server/class-request.php` * `includes/multi-currency/MultiCurrency.php` * `includes/wc-payment-api/class-wc-payments-api-client.php` * `includes/multi-currency/StorefrontIntegration.php` * `tests/unit/test-class-wc-payment-gateway-wcpay-process-payment.php` * `tests/unit/test-class-wc-payment-gateway-wcpay-subscriptions-payment-method-order-note.php` * `includes/admin/class-wc-payments-admin.php` * `tests/unit/subscriptions/test-class-wc-payments-subscription-migration-log-handler.php` * `includes/class-wc-payments-payment-request-button-handler.php` * `includes/admin/class-wc-rest-payments-orders-controller.php` * `includes/class-wc-payment-gateway-wcpay.php` * `includes/class-wc-payments-webhook-processing-service.php` * `includes/class-wc-payments-woopay-button-handler.php` * `tests/unit/test-class-wc-payments.php` * `includes/class-wc-payments-account.php` * `includes/class-wc-payments.php`

I think this matches well with some documentation effort on the hooks available in WooPayments so this is probably a good issue to address across the codebase.

Alternatively we could just ignore these outright. Either way we should go through all of these issues and either:

  1. Fix the issue, if it exists;
  2. Add ignores in-place via comments; or
  3. Add an ignore to phpcs.xml.dist.

Acceptance criteria

No more issues reported by phpcs.

### Tasks
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8546
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8547
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8548
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8549
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8550
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8551
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8552
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8553
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8554
- [ ] https://github.com/Automattic/woocommerce-payments/issues/8555
reykjalin commented 3 months ago

@vbelolapotkov I've split this issue up according to my best interpretation of the focus are labels in the repo. I kept the same priority for all the different issues.

If you could take a quick glance through the issues to make sure nothing is obviously in the wrong focus are that'd be great 🙏