Skip to content

Conversation

@owaisahmed5300
Copy link
Contributor

Changes

This update modernizes the WPTechnix coding standards to better align with PHP 8.1+ features and Slevomat's capabilities.

Class Structure Updates

  • PHPUnit & DI: Added specific sorting groups for setUp, @before, data providers, and inject* methods in SlevomatCodingStandard.Classes.ClassStructure.
  • Order: Enforced stricter visibility and static/final ordering.

Commenting & Formatting

  • Squiz vs. Slevomat: Disabled legacy Squiz commenting rules (File, Function, Block comments). These are now considered redundant as Slevomat handles docblock spacing, and Modern PHP types/attributes provide self-documentation.
  • Global References: Switched ReferenceUsedNamesOnly to allow fully qualified global functions/constants (e.g., \strlen()), improving performance and clarity.
  • Formatting: Added EmptyLinesAroundClassBraces (0 lines) and increased namespace spacing.

Safety

  • Added SlevomatCodingStandard.Variables.DisallowVariableVariable to prevent unsafe dynamic variable usage.

…g sniffs

- Update ClassStructure to enforce grouping for PHPUnit fixtures and DI methods.
- Disable rigid Squiz commenting sniffs; reliance shifted to Slevomat and types.
- Allow fully qualified global functions and constants in ReferenceUsedNamesOnly.
- Add DisallowVariableVariable and EmptyLinesAroundClassBraces sniffs.
- Relax multi-line method signature constraints and increase namespace spacing.
@owaisahmed5300 owaisahmed5300 merged commit d74c2c5 into main Nov 26, 2025
1 check passed
@owaisahmed5300 owaisahmed5300 deleted the feat/modernize-ruleset-structure branch November 27, 2025 07:54
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.

2 participants