Skip to content

[CodingStyle] Deprecate NewlineAfterStatementRector, as better fits coding standard - #8975

Merged
TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-newline-after-statement
Nov 17, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
tv-deprecate-newline-after-statement

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

Newlines between statements are a coding standard concern, not a refactoring one. The rule definition is also vague - "add empty new line after different-type statements" - so it kept clashing with coding standard tools, other Rector rules, and user preferences. Use ECS or PHP CS Fixer instead.

Changes:

  • NewlineAfterStatementRector marked @deprecated + DeprecatedInterface, body gutted to throw
  • removed from CodingStyleLevel (so from withCodingStyleLevel() and the coding style set)
  • removed rule tests and tests/Issues/Issue6840, rule dropped from IndentationCrash test config
  • removed now-unused NodeGroup::STMTS_TO_HAVE_NEXT_NEWLINE

Related issues - rectorphp/rector

Rule-specific:

Also mentioning the rule:

Related PRs - rectorphp/rector-src

Rule-specific fixes and tweaks:

Also mentioning the rule:

@TomasVotruba
TomasVotruba merged commit 9c08a0d into main Nov 17, 2026
51 checks passed
@TomasVotruba
TomasVotruba deleted the tv-deprecate-newline-after-statement branch November 17, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants