Skip to content

Adopt silverassist/coding-standards for PHPCS - #30

Merged
miguelcolmenares merged 2 commits into
mainfrom
feature/adopt-silverassist-coding-standards
Aug 12, 2026
Merged

Adopt silverassist/coding-standards for PHPCS#30
miguelcolmenares merged 2 commits into
mainfrom
feature/adopt-silverassist-coding-standards

Conversation

@miguelcolmenares

Copy link
Copy Markdown
Member

Summary

  • Adopts the shared SilverAssist PSR-12 ruleset (silverassist/coding-standards) — this is a library, not a WordPress plugin (no main plugin file, no plugins_loaded hook, no WordPress dependency in require), confirmed by this repo's own pre-existing ruleset already being PSR-12-based with a handful of hand-picked WordPress security/i18n sniffs on top, not full WordPress-Extra.
  • Surfaced 181 violations, all fixed: 103 auto-fixed, 72 comment-punctuation, 66 missing @return tags (each inferred from the actual function signature, not blanket mixed), 8 missing docblocks, 5 params needing a real mixed type hint to match their existing docblock.
  • phpstan.neon deliberately left untouched — this repo has no CI quality gate today (only Dependabot + CodeQL), and its committed config has 29 pre-existing PHPStan errors from accumulated dependency drift, unrelated to this change.

Test plan

  • vendor/bin/phpcs — clean
  • Full local WordPress Test Suite: 58/58 tests passing, 166 assertions

This is a library, not a WordPress plugin (no main plugin file, no
plugins_loaded hook, no WordPress dependency in composer.json's require),
so PSR-12 (silverassist/coding-standards) applies rather than
WordPress-Extra (silverassist/wp-coding-standards) -- confirmed by this
repo's own pre-existing ruleset, which already deliberately based itself
on PSR12 plus a hand-picked handful of WordPress security/i18n sniffs,
not full WordPress-Extra.

Adopting the shared SilverAssist ruleset (PSR-12 + mandatory PHPDoc)
surfaced 181 violations:
- 103 auto-fixed (phpcbf): spacing, boolean->bool, etc.
- 72 comments/param descriptions missing terminal punctuation.
- 66 missing @return tags -- inferred each one's actual return type from
  its function signature and inserted the correct tag, not a blanket
  @return mixed.
- 8 missing docblocks entirely (test methods).
- 5 untyped params that already had "@PARAM mixed" in their docblock but
  no matching `mixed` PHP type declaration -- added the real type hint.

phpstan.neon deliberately left untouched: this repo has zero CI quality
gate today (only Dependabot + CodeQL run), and its committed config
already has 29 pre-existing PHPStan errors unrelated to this change
(accumulated dependency drift, not something this PR should silently
absorb into an unrelated migration).

Verified with the real WordPress Test Suite, not just phpcs/phpstan:
58/58 tests passing.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adopts the shared SilverAssist PHPCS ruleset and aligns source and test documentation with its requirements.

Changes:

  • Adds the shared coding-standard dependencies and PHP 8.2 platform configuration.
  • Replaces the base PSR-12 ruleset with SilverAssist.
  • Adds PHPDoc return tags, punctuation, and explicit mixed parameter types.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
composer.json Adds PHPCS dependencies and platform configuration.
phpcs.xml Adopts the SilverAssist ruleset.
src/Updater.php Aligns types and PHPDoc with the ruleset.
src/UpdaterConfig.php Corrects PHPDoc punctuation.
tests/bootstrap.php Adds callback return documentation.
tests/wordpress-mocks.php Aligns mock types and PHPDoc.
tests/fixtures/mock-plugin/mock-plugin.php Adds return documentation.
tests/Integration/DownloadFilterTest.php Adds test return tags.
tests/Integration/UpdaterIntegrationTest.php Adds test return tags.
tests/Unit/UpdaterConfigTest.php Adds missing test documentation.
tests/Unit/UpdaterEnqueueScriptTest.php Adds and updates test documentation.
tests/WordPress/MockPluginTest.php Adds test return tags.
tests/WordPress/WordPressHooksTest.php Adds test return tags.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/bootstrap.php Outdated
Addresses Copilot review feedback -- the function never returns a value,
so documenting it as mixed was inaccurate and contradicted the PR's own
goal of inferring return tags from actual behavior, not a blanket
fallback.
@miguelcolmenares
miguelcolmenares merged commit 12ad374 into main Aug 12, 2026
4 checks passed
@miguelcolmenares
miguelcolmenares deleted the feature/adopt-silverassist-coding-standards branch August 12, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants