Skip to content

Fix linter errors for ./class-wc-facebookcommerce.php#3255

Closed
ajello-meta wants to merge 1 commit intomainfrom
phpcs-class-wc-facebookcommerce
Closed

Fix linter errors for ./class-wc-facebookcommerce.php#3255
ajello-meta wants to merge 1 commit intomainfrom
phpcs-class-wc-facebookcommerce

Conversation

@ajello-meta
Copy link
Copy Markdown
Contributor

Description

This PR fixes phpcs issues in ./class-wc-facebookcommerce.php. Comments were also added for several functions. The fixes were made manually (in conjunction with ./vendor/bin/phpcbf) to ensure that the logic remains the same. Running ./vendor/bin/phpcs:

FILE: /Users/angeloou/Local Sites/test-site-i/app/public/wp-content/plugins/facebook-for-woocommerce/class-wc-facebookcommerce.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 57 ERRORS AND 7 WARNINGS AFFECTING 45 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  28 | ERROR   | [ ] Missing doc comment for class WC_Facebookcommerce (Squiz.Commenting.ClassComment.Missing)
 183 | ERROR   | [x] Expected 1 space after the array opener in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceAfterArrayOpenerSingleLine)
 183 | ERROR   | [x] Expected 1 space before the array closer in a single line array. Found: no spaces (NormalizedArrays.Arrays.ArrayBraceSpacing.SpaceBeforeArrayCloserSingleLine)
 183 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
 196 | ERROR   | [x] Must use "self::" for local static member reference (Squiz.Classes.SelfMemberReference.NotUsed)
 207 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 208 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 209 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 210 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 211 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 212 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 213 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 215 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 216 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 217 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 218 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 236 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines (Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines)
 241 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 241 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 10 spaces but found 18 spaces (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
 243 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 243 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 18 spaces but found 22 spaces (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
 244 | ERROR   | [x] Spaces must be used for mid-line alignment; tabs are not allowed (Universal.WhiteSpace.DisallowInlineTabs.NonIndentTabsUsed)
 244 | WARNING | [x] Equals sign not aligned with surrounding assignments; expected 9 spaces but found 13 spaces (Generic.Formatting.MultipleStatementAlignment.NotSameWarning)
 245 | ERROR   | [x] Functions must not contain multiple empty lines in a row; found 2 empty lines (Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines)
 256 | ERROR   | [x] No space after opening parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis)
 256 | ERROR   | [x] No space before closing parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis)
 261 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)
 261 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
 389 | ERROR   | [x] Space after opening control structure is required (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen)
 389 | ERROR   | [x] No space before opening parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis)
 389 | ERROR   | [x] Expected 1 space after IF keyword; 0 found (Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword)
 543 | ERROR   | [x] Must use "self::" for local static member reference (Squiz.Classes.SelfMemberReference.NotUsed)
 544 | ERROR   | [x] Must use "self::" for local static member reference (Squiz.Classes.SelfMemberReference.NotUsed)
 563 | ERROR   | [ ] Comment missing for @throws tag in function comment (Squiz.Commenting.FunctionComment.EmptyThrows)
 915 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 916 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 917 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 918 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 919 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 920 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 921 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 922 | ERROR   | [x] Expected 5 spaces before asterisk; 4 found (Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar)
 923 | ERROR   | [ ] Visibility must be declared on method "add_whatsapp_consent_checkout_fields" (Squiz.Scope.MethodScope.Missing)
 923 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterOpen)
 923 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingBeforeClose)
 924 | ERROR   | [x] No space after opening parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis)
 924 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)
 924 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
 924 | ERROR   | [x] No space before closing parenthesis is prohibited (WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis)
 926 | ERROR   | [x] Multi-line function call not indented correctly; expected 16 spaces but found 20 (PEAR.Functions.FunctionCallSignature.Indent)
 927 | WARNING | [x] Array double arrow not aligned correctly; expected 12 space(s) between "'id'" and double arrow, but found 7.
     |         |     (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 928 | WARNING | [x] Array double arrow not aligned correctly; expected 9 space(s) between "'label'" and double arrow, but found 4.
     |         |     (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 928 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)
 928 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
 929 | WARNING | [x] Array double arrow not aligned correctly; expected 6 space(s) between "'location'" and double arrow, but found 1.
     |         |     (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 930 | WARNING | [x] Array double arrow not aligned correctly; expected 10 space(s) between "'type'" and double arrow, but found 5.
     |         |     (WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned)
 931 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)
 931 | ERROR   | [x] There should be a comma after the last array item in a multi-line array. (NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine)
 931 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
 933 | ERROR   | [x] Multi-line function call not indented correctly; expected 12 spaces but found 16 (PEAR.Functions.FunctionCallSignature.Indent)
 943 | ERROR   | [x] Additional blank lines found at end of doc comment (Generic.Commenting.DocComment.SpacingAfter)
 964 | ERROR   | [ ] A file should either contain function declarations or OO structure declarations, but not both. Found 1 function declaration(s) and 1 OO structure declaration(s). The
     |         |     first function declaration was found on line 964; the first OO declaration was found on line 28 (Universal.Files.SeparateFunctionsFromOO.Mixed)
 965 | ERROR   | [x] Expected 1 spaces after opening parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket)
 965 | ERROR   | [x] Expected 1 spaces before closing parenthesis; 0 found (PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 60 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Syntax change (non-breaking change which fixes code modularity, linting or phpcs issues)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected

Test Plan

  1. Run ./vendor/bin/phpcs, you should get no errors in ./class-wc-facebookcommerce.php.
  2. Run extension and test the basic functionality to ensure everything still works as intended.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Latest Plugin Build

Built at: 2025-05-27T22:08:20.580Z
Commit: 421b1ef
Size: 1.1M

Download: Click here to download the plugin

To download: Click the link above → Scroll to bottom → Download "facebook-for-woocommerce" artifact

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ajello-meta has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ajello-meta merged this pull request in c89863f.

@carterbuce carterbuce mentioned this pull request May 29, 2025
@tzahgr tzahgr mentioned this pull request Jun 4, 2025
facebook-github-bot pushed a commit that referenced this pull request Jun 4, 2025
Summary:
= 3.5.0 - 2025-05-28 =
*  Add - Create basic checkout permalink w/ products and coupon support by ajello-meta in #2887
*  Add - Common Feed Upload Framework by Jmencab in #2875
*  Fix - Fix bug where templates were not loading correctly by ajello-meta in #2915
*  Tweak - Change MICE to use base site url instead of shop url by carterbuce in #2934
*  Tweak - Improve custom checkout UI by ajello-meta in #2930
*  Tweak - Make custom checkout UI mobile compatible by ajello-meta in #2942
*  Fix - Update parsing for Checkout URL Product IDs by carterbuce in #2935
*  Add - Implement dummy logging util by nealweiMeta in #2920
*  Add - Setup cron job for batch logging with global message queue by nealweiMeta in #2924
*  Add - Error log request api activate by nealweiMeta in #2933
*  Add - Log locally with debug mode enabled by nealweiMeta in #2939
*  Add - Ratings and reviews feed upload by nrostrow-meta in #2937
*  Tweak - Feed upload skip logic and logging calls by nrostrow-meta in #2964
*  Add - Add function to fetch feed upload instance by nrostrow-meta in #2970
*  Tweak - Have feed uploads always use feed generator by nrostrow-meta in #2971
*  Tweak - Trigger metadata feed uploads on CPI ID change (post onboarding) by nrostrow-meta in #2995
*  Add - Shipping profile feed upload button by nrostrow-meta in #3140
*  Add - Navigation menu feed upload logic by nrostrow-meta in #3159
*  Fix - Fixing some fclose and logging gaps in the feed upload logic by nrostrow-meta in #3192
*  Add - Enabling navigation menu feed upload and adding manual sync button by nrostrow-meta in #3223
*  Add - Promotions feed upload by carterbuce in #2941
*  Add - Plugin AJAX API Framework by sol-loup in #2928
*  Tweak - Test Infrastructure Enhancement by sol-loup in #2944
*  Add - Implement telemetry logs api by nealweiMeta in #2940
*  Fix -  Make error logging event configurable by nealweiMeta in #2954
*  Add - Implement logging toggle by nealweiMeta in #2959
*  Fix - auto products sync by nealweiMeta in #2978
*  Tweak - Sync products with restriction by nealweiMeta in #2983
*  Fix - Fix use_enhanced_onboarding for legacy connections by carterbuce in #2986
*  Add - Create enhanced settings UI by ajello-meta in #2968
*  Add - Create new troubleshooting drawer from legacy debug settings by ajello-meta in #2977
*  Add - Add manual product and coupon sync buttons by ajello-meta in #2984
*  Tweak - Make page title in enhanced settings static by ajello-meta in #2985
*  Tweak - Align finalized content for logging toggle by nealweiMeta in #2992
*  Tweak - Improve local log by nealweiMeta in #3009
*  Fix - Fix free shipping coupon sync by carterbuce in #2993
*  Tweak - Add logging for feed generation scheduling failure by carterbuce in #2994
*  Tweak - Add logging in checkout for coupon code by ajello-meta in #2991
*  Tweak - Clean up CSS in enhanced settings UI by ajello-meta in #2996
*  Tweak - Remove the "Advertise" tab by ajello-meta in #3024
*  Tweak - Sync "Usage Count" in Promos Feed by carterbuce in #3036
*  Tweak - Disable mini_shops product capability for unsupported items by carterbuce in #3084
*  Add - Add usage logging for enhanced settings tabs by ajello-meta in #3202
*  Tweak - Remove UI of a checkbox that controls enablement of the new style feed generation by mshymon in #3056
*  Fix - Fix linter errors for ./includes/fbutils.php files by ajello-meta in #3075
*  Fix - Hotfix for Rollout Switches by vinkmeta in #3236
*  Add - Opt out sync experience. by SayanPandey in #3220
*  Fix - Added a transient flag to avoid flooding of product set api requests by vinkmeta in #3245
*  Fix - Additional check for the opt-out banner by SayanPandey in #3259
*  Fix - Bump up GraphAPI version to 21 by vahidkay-meta in #3219
*  Fix - fix linter errors for ./class-wc-facebookcommerce.php by ajello-meta in #3255
*  Fix - fix linter errors for ./facebook-commerce-events-tracker.php by ajello-meta in #3254
*  Fix - fix linter errors for ./includes/Admin/Settings_Screens/Advertise.php by ajello-meta in #3237
*  Fix - fix linter errors for ./includes/Admin/Settings_Screens/Product_Sync.php by ajello-meta in #3239
*  Fix - fix function return typing for get_settings() by ajello-meta in #3257
*  Tweak - Addition check for opt out by SayanPandey in #3259
*  Tweak - Update the GraphAPI version to 21 by vahidkay-meta in #3219
*  Fix - Enabled rollout switch only for plugin admins by vinkmeta in #3242
*  Add - reset connection functionality by jczhuoMeta in #3262
*  Fix - fixing the non static method called as static issue by SayanPandey in #3263
*  Fix - Fix linter errors for ./facebook-commerce.php by ajello-meta in #3251

Pull Request resolved: #3264

Test Plan:
Imported from GitHub, without a `Test Plan:` line.

**!---- (auto-generated) DO NOT EDIT OR PUT ANYTHING AFTER THIS LINE ----!**
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: bloks / Diff Version V7
https://internalfb.com/intern/testinfra/testrun/10414574226197703
MFTRunTestsScript Run / Test Suite: sa_checkout / Test Collection: www / Diff Version V7
https://internalfb.com/intern/testinfra/testrun/844425351364266

Reviewed By: vinkmeta, nrostrow-meta

Differential Revision: D75569981

Pulled By: carterbuce

fbshipit-source-id: 11bb39a9d66dfcbc80af413466feef0792d27ce4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants