Skip to content

Drop trailing whitespace from prefixed empty lines - #16

Merged
ruudk merged 1 commit into
mainfrom
ruudk/doc-comment-empty-lines
Nov 27, 2026
Merged

ruudk merged 1 commit into
mainfrom
ruudk/doc-comment-empty-lines

Conversation

@ruudk

@ruudk ruudk commented Nov 27, 2026

Copy link
Copy Markdown
Owner

prefix() put the full prefix in front of every line, including empty ones. An empty line in a doc comment or block comment became *, with a trailing space:

$generator->docComment(['Summary', '', '@deprecated Use something else']);
/**
 * Summary
 * ␣
 * @deprecated Use something else
 */

Code that wanted a clean blank line had to write the comment by hand. ruudk/graphql-client-code-generator does that for deprecated enum cases.

An empty line now gets the prefix without its trailing whitespace ( *, //, >). That matches indent(), which already leaves empty lines empty. Lines with content are unchanged.

testDocCommentWithFullDump and testBlockCommentWithEmptyString asserted the trailing space, so they now expect *. New tests cover prefix() with empty lines and a doc comment with a blank separator line.

`prefix()` put the full prefix in front of an empty line, so an empty
line in a doc comment became ` * ` with a trailing space. Callers had to
write such comments by hand to avoid it. An empty line now gets the
prefix without its trailing whitespace (` *`, `//`), the same way
`indent()` leaves empty lines empty.
@ruudk
ruudk merged commit d692771 into main Nov 27, 2026
2 checks passed
@ruudk
ruudk deleted the ruudk/doc-comment-empty-lines branch November 27, 2026 07:58
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