Skip to content

Blink: port 12 Squiz sniffs and Generic ScopeIndent - #407

Merged
TomasVotruba merged 11 commits into
mainfrom
blink-phpcs-squiz
Nov 19, 2026
Merged

TomasVotruba merged 11 commits into
mainfrom
blink-phpcs-squiz

Conversation

@TomasVotruba

@TomasVotruba TomasVotruba commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Ports 12 more Squiz sniffs and Generic ScopeIndent to blink. PHP_CodeSniffer coverage goes from 101/114 to 114/114 - every fixable PHP_CodeSniffer sniff is now in blink. Rebased on #406.

Each matches ECS output byte for byte on the upstream PHPCS 4.0.4 test inputs (TestPhpcsUpstreamFixtures), and was also compared against ECS (one file per process) on vendor files and tab-indented copies.

  • Generic WhiteSpace: ScopeIndent - builds on the Blink: port 21 PSR2, PSR12 and PEAR PHP_CodeSniffer sniffs #405 scope map; adds PHPCS's level map (levelMap()) and startOfStatementIgnoring to phpcs_scope.go. ECS never sets PHPCS's fixer->enabled, so the sniff's nested re-indent block is inert under ECS and the port mirrors that.
  • Arrays: ArrayDeclaration
  • Classes: ClassDeclaration (reuses the PEAR/PSR2 port)
  • Commenting: BlockComment, FunctionComment (reuses the PEAR port)
  • ControlStructures: ControlSignature, SwitchDeclaration
  • Formatting: OperatorBracket
  • Functions: FunctionDeclarationArgumentSpacing, MultiLineFunctionDeclaration (reuses the PEAR port)
  • PHP: EmbeddedPhp
  • WhiteSpace: ControlStructureSpacing, ScopeClosingBrace

Shared changes:

  • slevomat.go - yield ... from with a comment or newline inside is one token in PHP 8.3+, PHPCS splits it into yield, the tokens between and from; slvSplit now does the same.
  • priorities.go - slevomat UselessSemicolon raised from 0 to 1 so it removes if (...) {}; before Squiz ControlStructureSpacing looks at the line (TestAllFixersIdempotent), like NoEmptyStatementFixer.
  • pear_function_comment.go / pear_function_declaration.go - split into reusable pieces for the Squiz subclasses; PEAR behavior unchanged.

phpcs-not-ported.txt is now empty.

@TomasVotruba TomasVotruba changed the title Blink: port 12 Squiz PHP_CodeSniffer sniffs Blink: port 12 Squiz sniffs and Generic ScopeIndent Nov 19, 2026
@TomasVotruba
TomasVotruba merged commit ab80eb4 into main Nov 19, 2026
12 checks passed
@TomasVotruba
TomasVotruba deleted the blink-phpcs-squiz branch November 19, 2026 22: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.

1 participant