Skip to content

Add LineBreakBeforeThrowExpressionFixer#14

Merged
spawnia merged 11 commits intomasterfrom
line-break-before-throw-expression
Jan 19, 2026
Merged

Add LineBreakBeforeThrowExpressionFixer#14
spawnia merged 11 commits intomasterfrom
line-break-before-throw-expression

Conversation

@spawnia
Copy link
Member

@spawnia spawnia commented Jan 16, 2026

Summary

  • Adds a new custom PHP-CS-Fixer that enforces line breaks before ?? throw and ?: throw expressions
  • Improves code readability by preventing long one-liners with coalesce/elvis throw patterns

🤖 Generated with Claude Code

spawnia and others added 6 commits January 16, 2026 17:19
Co-Authored-By: Claude <noreply@anthropic.com>
Remove IndentationTrait dependency (added in v3.87.0) and
implement indentation detection inline for compatibility with
the ^3.19.2 version constraint.

Co-Authored-By: Claude <noreply@anthropic.com>
Throw expressions (e.g., `?? throw`) are PHP 8.0+ syntax. The test
file cannot be parsed by PHP 7.4, so it must be excluded from the
test suite on older PHP versions.

Co-Authored-By: Claude <noreply@anthropic.com>
@spawnia spawnia marked this pull request as ready for review January 16, 2026 16:52
@spawnia spawnia requested a review from simbig January 16, 2026 16:52
spawnia and others added 3 commits January 19, 2026 14:31
Since single_line_throw ensures exceptions are on one line, the
adjustFollowingIndentation and findStatementEnd methods are not needed.

Co-Authored-By: Claude <noreply@anthropic.com>
@spawnia spawnia merged commit 1c51056 into master Jan 19, 2026
15 checks passed
@spawnia spawnia deleted the line-break-before-throw-expression branch January 19, 2026 15:56
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