Skip to content

Blink: keep whitespace-only lines in NoTrailingWhitespace - #339

Merged
TomasVotruba merged 1 commit into
ecsphp:mainfrom
owenvoke:blink-no-trailing-whitespace-keep-blank-lines
Nov 9, 2026
Merged

TomasVotruba merged 1 commit into
ecsphp:mainfrom
owenvoke:blink-no-trailing-whitespace-keep-blank-lines

Conversation

@owenvoke

@owenvoke owenvoke commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

PHP-CS-Fixer trims a whitespace token only up to its first line break: the segments after it are pure whitespace, and it only rewrites a segment when trimming leaves something behind. A line holding nothing but spaces is therefore left alone, as is a trailing single-line run unless it ends the file. The Go port stripped every run before a newline, so it emptied those lines and reported files the PHP engine passes.

Trim the same span PHP does, including its open-tag exception, and treat \r\n and a lone \r as line breaks as \R does.

PHP-CS-Fixer trims a whitespace token only up to its first line break: the
segments after it are pure whitespace, and it only rewrites a segment when
trimming leaves something behind. A line holding nothing but spaces is
therefore left alone, as is a trailing single-line run unless it ends the
file. The Go port stripped every run before a newline, so it emptied those
lines and reported files the PHP engine passes.

Trim the same span PHP does, including its open-tag exception, and treat
`\r\n` and a lone `\r` as line breaks as `\R` does.
@TomasVotruba
TomasVotruba merged commit 6857c6f into ecsphp:main Nov 9, 2026
12 checks passed
@TomasVotruba

Copy link
Copy Markdown
Member

Thank you 👍

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