Skip to content

Add root phpcs.xml.dist for project PHP standards#49

Merged
ryanwelcher merged 2 commits intotrunkfrom
add/phpcs-config
Mar 31, 2026
Merged

Add root phpcs.xml.dist for project PHP standards#49
ryanwelcher merged 2 commits intotrunkfrom
add/phpcs-config

Conversation

@juanmaguitar
Copy link
Copy Markdown
Collaborator

Summary

Adds the project-wide phpcs.xml.dist configuration as agreed in Discussion #22 and tracked by #47.

  • PSR-12 base for naming conventions and code structure
  • WordPress whitespace conventions: tab indentation, spaces inside parentheses for control structures, cast spacing, operator spacing, and array declaration spacing
  • WordPress security sniffs: WordPress.Security, WordPress.DB.PreparedSQL, WordPress.WP.EnqueuedResources, WordPress.PHP.NoSilencedErrors, WordPress.WP.DeprecatedFunctions
  • Yoda conditions disabled per team agreement
  • PHP 8.1+ compatibility via PHPCompatibilityWP
  • Pattern folder exclusions for GlobalVariablesOverride and ScopeIndent

Closes #47

Test plan

  • Run composer install (ensure squizlabs/php_codesniffer, wp-coding-standards/wpcs, and phpcompatibility/phpcompatibility-wp are available)
  • Run vendor/bin/phpcs from the repo root and verify it picks up phpcs.xml.dist
  • Confirm tab indentation is enforced and space indentation is flagged
  • Confirm WordPress whitespace rules apply (e.g., if( $x ) flags missing space after if)
  • Confirm PSR-12 naming rules apply (e.g., class names must be PascalCase)
  • Confirm files in */patterns/* are excluded from GlobalVariablesOverride and ScopeIndent sniffs
  • Confirm */vendor/*, */node_modules/*, and */build/* directories are excluded

🤖 Generated with Claude Code

Implements the team-agreed coding standards from Discussion #22:
PSR-12 as the base for naming/structure, with WordPress whitespace
conventions (tabs, spaces inside parens), security sniffs, PHP 8.1+
compatibility checks, and pattern-folder exclusions.

Closes #47

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ryanwelcher ryanwelcher merged commit de29fb5 into trunk Mar 31, 2026
3 checks passed
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.

Project PHP standards

2 participants