Skip to content

3.1.0#65

Merged
piqusy merged 10 commits intomainfrom
release/3.1.0
Apr 8, 2026
Merged

3.1.0#65
piqusy merged 10 commits intomainfrom
release/3.1.0

Conversation

@piqusy
Copy link
Copy Markdown
Contributor

@piqusy piqusy commented Apr 8, 2026

Description

Summary

  • Adds Eightshift.ControlStructures.DisallowAlternativeSyntax sniff that errors on endif, endforeach, endfor, endwhile, and endswitch — enforcing curly braces for all control structures
  • Fixes phpunit.xml.dist to point to AllSniffs.php as the test suite entry point (fixes pre-existing Undefined global variable $PHP_CODESNIFFER_STANDARD_DIRS error affecting all tests)
  • Includes unit test fixture and documentation
  • Updated PHP_CodeSniffer repository link and schema URL

@piqusy piqusy added this to the 3.1.0 milestone Apr 8, 2026
@piqusy piqusy requested a review from a team April 8, 2026 06:54
@piqusy piqusy self-assigned this Apr 8, 2026
iruzevic
iruzevic previously approved these changes Apr 8, 2026
dadadavorin
dadadavorin previously approved these changes Apr 8, 2026
Update PHP_CodeSniffer repository link and schema URL
@piqusy piqusy dismissed stale reviews from dadadavorin and iruzevic via 5bf7c5d April 8, 2026 07:09
@piqusy piqusy requested review from dadadavorin and iruzevic April 8, 2026 07:20
@dingo-d
Copy link
Copy Markdown
Contributor

dingo-d commented Apr 8, 2026

https://github.com/PHPCSStandards/PHPCSExtra?tab=readme-ov-file#universalcontrolstructuresdisallowalternativesyntax-wrench-bar_chart-books

🥲

You can just use existing sniffs 🙈

…niversal.ControlStructures.DisallowAlternativeSyntax

- Remove custom DisallowAlternativeSyntaxSniff and its unit tests and docs
- Enable Universal.ControlStructures.DisallowAlternativeSyntax from PHPCSExtra
  (already a transitive dependency via WPCS, no new composer requirement)
- Set allowWithInlineHTML=false for strict enforcement matching previous behavior
- PHPCSExtra sniff adds auto-fixer, metrics, per-structure error codes, and docs
@piqusy
Copy link
Copy Markdown
Contributor Author

piqusy commented Apr 8, 2026

Good call, @dingo-d — replaced the custom sniff with Universal.ControlStructures.DisallowAlternativeSyntax from PHPCSExtra. PHPCSExtra is already a transitive dependency via WPCS so no new composer.json requirement is needed.

Set allowWithInlineHTML=false to keep strict enforcement (no alternative syntax allowed even when inline HTML is present between the control structure tags — relevant for PHP template files that mix if (): ... endif; with raw HTML). This matches the behavior of the removed custom sniff.

The custom sniff, its unit tests, and its docs XML have all been removed.

@piqusy piqusy merged commit 6110076 into main Apr 8, 2026
8 of 21 checks passed
@piqusy piqusy deleted the release/3.1.0 branch April 8, 2026 08:29
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.

7 participants