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

feat(formatter): always break property hooks into multiple lines #126

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

azjezz
Copy link
Member

@azjezz azjezz commented Mar 8, 2025

📌 What Does This PR Do?

This PR modifies the formatter to always break property hooks (getters and setters) into multiple lines, regardless of the print_width setting.

🔍 Context & Motivation

Previously, property hooks were only broken into multiple lines if they didn't fit within the print_width. This could lead to unexpected single-line property hooks when users had a very large print_width value, compromising readability. This change ensures consistent formatting and improves readability for all users.

🛠️ Summary of Changes

  • Feature: Changed the formatter to always break property hooks into multiple lines.
  • Exception: Property hook lists with no hooks ({}) remain on a single line.
  • Tests: Updated test snapshots to reflect the new formatting.

📂 Affected Areas

  • Linter
  • Formatter
  • CLI
  • Composer Plugin
  • Dependencies
  • Documentation
  • Other (please specify):

🔗 Related Issues or PRs

Closes #124

📝 Notes for Reviewers

This commit changes the formatter to always break property hooks (getters and setters) into multiple lines, regardless of the `print_width` setting. Previously, property hooks were only broken into multiple lines if they didn't fit within the `print_width`. This change ensures consistent formatting and improves readability, especially for users with large `print_width` values.

The only exception is when a property hook list is empty (`{}`), in which case it remains on a single line.

This addresses an issue where property hooks could unexpectedly become single-line when `print_width` was very large, leading to poor readability.

Signed-off-by: azjezz <azjezz@protonmail.com>
@azjezz azjezz added Priority: High After critical issues are fixed, handle these before any further issues. Type: Enhancement Request for additions or changes that improve existing functionality. Subject: Formatter An issue or PR related to the formatter. Status: Closed This issue is closed and no more work is planned. labels Mar 8, 2025
@azjezz azjezz self-assigned this Mar 8, 2025
@azjezz azjezz merged commit f0b5edf into main Mar 8, 2025
4 checks passed
@azjezz azjezz deleted the formt-hooks branch March 8, 2025 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High After critical issues are fixed, handle these before any further issues. Status: Closed This issue is closed and no more work is planned. Subject: Formatter An issue or PR related to the formatter. Type: Enhancement Request for additions or changes that improve existing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting issue with asymettric properties
1 participant