Skip to content

Fix PHPCS/WPCS violations and add missing docblocks - #30

Open
miyanialkesh7 wants to merge 1 commit into
wptrainingteam:trunkfrom
miyanialkesh7:phpcs-wpcs-fixes
Open

Fix PHPCS/WPCS violations and add missing docblocks#30
miyanialkesh7 wants to merge 1 commit into
wptrainingteam:trunkfrom
miyanialkesh7:phpcs-wpcs-fixes

Conversation

@miyanialkesh7

Copy link
Copy Markdown

Summary

  • Auto-fixed 161 mechanical PHPCS/WPCS violations (tabs-vs-spaces indentation, doc-comment alignment, missing end-of-file newline) via phpcbf — no logic changes.
  • Added missing file, class, and method docblocks to Plugin_Paths, Register_Blocks, and Enqueues, and to both block render.php templates.
  • Added phpcs:ignore with an explanatory comment on two false-positive WordPress.Security.EscapeOutput.OutputNotEscaped findings — get_block_wrapper_attributes() and wp_interactivity_data_wp_context() both already escape their own output; re-escaping would corrupt the HTML attributes they emit.
  • Renamed the unprefixed local $unique_id to $advanced_multi_block_unique_id in toggle/render.php to satisfy WordPress.NamingConventions.PrefixAllGlobals.
  • Excluded WordPress.Files.FileName.* sniffs in phpcs.xml.dist with a comment explaining why: this plugin intentionally uses namespaced classes autoloaded via Composer's PSR-4, so filenames match class names rather than the classic class-{name}.php convention — enforcing that sniff would fight the plugin's own architecture.

Result

composer run lint (phpcs): 127 errors / 59 warnings → 0 errors / 0 warnings

Test Plan

  • php -l passes on all 7 touched files
  • composer run lint reports 0 errors, 0 warnings
  • Manual diff review confirms zero behavioral changes — whitespace, docblocks, comments, and one local variable rename only

Auto-fix mechanical indentation/whitespace violations via phpcbf, add
missing file/class/method docblocks, document two escaping
false-positives with phpcs:ignore, prefix a local template variable,
and exclude the classic WP file-naming sniffs since this plugin uses
namespaced classes autoloaded via Composer's PSR-4.
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.

1 participant