final class CodeStyleConfigTest extends TestCase (View source)

Guards composer cs-fix against re-acquiring a rule that treats a comment-only body as empty.

The repo used to register a custom PhpStorm/braces_one_line fixer that located a block's closing brace with Tokens::getNextMeaningfulToken(). That helper skips T_COMMENT and T_DOC_COMMENT, so a body whose only content was a comment looked empty; the fixer then cleared every token in the range and rebuilt it as }, deleting the comment. Running the real fixer over a three-method class reproduced it: the line comment and the block comment both vanished.

Nothing caught that, because a formatter is only ever exercised by running it. So this asserts on the actual configured rule set by invoking the actual binary — a rules-array assertion would pass for any future rule with the same flaw under a different name.

Constants

private SOURCE

Deliberately already conformant apart from the empty bodies, so a single fixer run produces exactly one intended change: trulyEmpty() collapses, the other two must not.

Methods

void
tearDown()

No description

Details

protected void tearDown()

No description

Return Value

void

void testCsFixPreservesCommentOnlyBodiesButStillCollapsesEmptyOnes()

No description

Return Value

void