Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bracket placement issues #186

Merged
merged 5 commits into from
Jan 17, 2025
Merged

Fix bracket placement issues #186

merged 5 commits into from
Jan 17, 2025

Conversation

lkrms
Copy link
Owner

@lkrms lkrms commented Jan 17, 2025

No description provided.

lkrms added 2 commits January 14, 2025 17:43
- Upstream changes mean `pretty-php` now refuses to run as root
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 91.74312% with 9 lines in your changes missing coverage. Please review.

Project coverage is 95.92%. Comparing base (25d57a1) to head (7e04993).
Report is 7 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/TokenUtil.php 25.00% 6 Missing ⚠️
src/Rule/SemiStrictExpressions.php 80.00% 2 Missing ⚠️
src/Rule/PlaceBrackets.php 94.73% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #186      +/-   ##
============================================
- Coverage     96.03%   95.92%   -0.12%     
- Complexity     2792     2805      +13     
============================================
  Files            67       68       +1     
  Lines          7119     7160      +41     
============================================
+ Hits           6837     6868      +31     
- Misses          282      292      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lkrms added 3 commits January 17, 2025 16:28
- Move bracket mirroring from `StandardIndentation` to standalone rule
  `PlaceBrackets` and prioritise it to run earlier
- Refactor and/or prioritise other rules so changes to vertical
  whitespace near brackets are applied before `PlaceBrackets`, incl.:
  - Move suppression of whitespace in empty `for` expressions from
    `VerticalSpacing` to `StandardSpacing`
  - Place `for` expressions on their own lines in `StrictExpressions`
    and `SemiStrictExpressions`
  - Run `StrictLists` after `*StrictExpressions` to ensure `for`
    expressions that break over multiple lines are not collapsed
- Add `FOR_PARTS` to token data and parse `for` expressions in `Parser`
  instead of duplicating code in `VerticalSpacing`
- Add `TokenCollection::setWhitespace()` and adopt in scenarios where
  suppression of whitespace should not be removed
- Similarly, replace `TokenCollection::applyInnerWhitespace()` with
  `setInnerWhitespace()`
- `setWhitespace()` -> `setTokenWhitespace()`
- `applyWhitespace()` -> `applyTokenWhitespace()`
@lkrms lkrms merged commit 40ee45e into main Jan 17, 2025
25 checks passed
@lkrms lkrms deleted the cleanup branch January 17, 2025 05:50
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