Releases: carthage-software/mago
Mago 0.19.0
Mago 0.19.0 🪄
This release delivers a mix of exciting new features and crucial bug fixes, ensuring a more robust and flexible formatting experience.
✨ New Features
- Preserve Line Breaks in Conditional Expressions 🧱 (#132):
- Introducing the
preserve_breaking_conditional_expression
option! - Now you can control line breaks in ternary expressions, maintaining your preferred formatting, even for complex conditionals.
- Introducing the
🛠️ Bug Fixes
- Multiple Formatting Bugs Addressed 🐛:
- We've squashed numerous formatting bugs, improving accuracy and reliability across the board.
- Comprehensive regression tests have been added to ensure these fixes stick!
- Argument Printing and Member Access Chain Logic Fixed (#131):
- Corrected issues with argument printing and member access chains, ensuring consistent and correct formatting.
- Asymmetric Visibility Modifier Reflection Fixed 🛠️:
- Resolved a reflection issue related to asymmetric visibility modifiers, ensuring accurate reflection.
We hope you enjoy the improvements!
Full Changelog: 0.18.1...0.19.0
Mago 0.18.1
Mago 0.18.1 🛠️
This is a patch release to address a critical build issue in 0.18.0
.
🐛 Bug Fixes
- Fixed x86_64-unknown-linux-gnu Build Issue:
0.18.0
was missing the build artifact forx86_64-unknown-linux-gnu
due to a CI workflow error. This release corrects the workflow and provides the missing build.
📝 Note
- No code changes were introduced between
0.18.0
and0.18.1
. This release solely addresses the build issue.
Full Changelog: 0.18.0...0.18.1
Mago 0.18.0
Mago 0.18.0 🪄
This release brings a plethora of improvements to both the formatter and linter, focusing on enhanced readability, flexibility, and robustness.
🚀 Formatter Enhancements
- Tabular Array Formatting with Alignment 📊 (#127):
- Expanded support for expressions within Tabular arrays, now including function calls, static method calls, and class constant access.
- Fixed a critical width calculation issue for the Arabic word "الله", ensuring correct alignment.
- Relaxed row size consistency requirements, allowing for tabular formatting even with minor inconsistencies.
- Consistent Property Hook Formatting 🎣 (#126):
- Property hooks (getters and setters) are now consistently broken into multiple lines, irrespective of
print_width
, enhancing readability. - The only exception is empty hook lists (
{}
), which remain on a single line.
- Property hooks (getters and setters) are now consistently broken into multiple lines, irrespective of
- Preserve Line Break Options 🧱 (#125):
- Introduced five new configuration options to give you fine-grained control over line breaks:
preserve_breaking_member_access_chain
preserve_breaking_argument_list
preserve_breaking_array_like
preserve_breaking_parameter_list
preserve_breaking_attribute_list
- These options allow you to maintain your preferred code structure.
- Introduced five new configuration options to give you fine-grained control over line breaks:
- Parentheses for Literal Numbers in Concatenation 🔢:
- Added parentheses around literal integers and floats within concatenation binary operations for improved clarity.
🛡️ Linter Improvements
- New PSL Plugin 🧩 (#121):
- Introduced a new linter plugin dedicated to Psl (PHP Standard Library) checks, boosting code quality.
🛠️ CLI Improvements
- Enhanced
composer.json
Config Generation 📦:- In the
mago init
command, when generating configuration fromcomposer.json
, non-existent autoload paths are now automatically removed. - Redundant subpaths are also removed, leading to a much cleaner configuration.
- In the
- Config Parsing During Self-Update 🔄:
- Fixed an issue where configuration parsing was incorrectly triggered during the
self-update
command.
- Fixed an issue where configuration parsing was incorrectly triggered during the
- Simplified Formatter Configuration ⚙️:
- Simplified the internal formatter configuration for better maintainability.
🤝 Community Contributions
A huge thank you to @bendavies and @innocenzi for their invaluable contributions! Your bug reports, suggestions, and feedback have been instrumental in improving Mago. Community feedback is what keeps Mago improving!
🧹 Other Changes
- Various chore and maintenance updates to keep things running smoothly.
Full Changelog: 0.17.0...0.18.0
Mago 0.17.0
Mago 0.17.0 🪄
This release of Mago brings new linting rules for Laravel, more formatter options, and bug fixes!
Laravel Linting 🔎
- New Laravel rules: We've added three new linting rules to the Laravel plugin, helping you write cleaner and more idiomatic Laravel code (by @azjezz in #116):
- **
laravel/anonymous-migration
: Encourages the use of anonymous classes for migrations. - **
laravel/middleware-in-routes
: Enforces applying middleware in routes files instead of controllers. - **
laravel/view-array-parameter
: Promotes passing data to views using the array parameter in theview()
function.
- **
Formatter Enhancements 🛠️
- More control over formatting: Four new formatter options give you finer control over how your code is styled (by @azjezz in #114):
- **
array_table_style_alignment
: Enables or disables table-style alignment for arrays. - **
always_break_named_arguments_list
: Controls whether to always break named argument lists into multiple lines. - **
always_break_attribute_named_argument_lists
: Controls whether to always break named argument lists in attributes into multiple lines. - **
parentheses_in_attribute
: Controls whether to include parentheses in attributes when they contain no arguments.
- **
Bug Fixes 🐛
- Member access chain comments: Fixed a bug where comments in member access chains were printed after the access operator instead of before. (by @azjezz in #113)
- Match expression formatting: Fixed a bug that caused incorrect formatting of the
default
arm inmatch
expressions. (by @azjezz in #112) - Binary expression indentation: Fixed a bug that caused incorrect indentation of multi-line binary expressions within parentheses. (by @azjezz in #111)
- Arrow function formatting: Improved the formatting of arrow functions, including better handling of parentheses and argument list breaking. (by @azjezz in #109)
This release includes valuable additions and improvements for both the linter and formatter, making Mago an even more powerful tool for analyzing and styling your PHP code. Enjoy! 🎉
Full Changelog: 0.16.0...0.17.0
Mago 0.16.0
Mago 0.16.0 🪄
This release of Mago focuses on refining the formatter and removing unused configuration options.
Formatter Improvements
- Removed
keyword_case
option: Keywords will now always be formatted in lowercase, adhering to standard conventions and simplifying the configuration. (by @azjezz in #108) - Removed
blank_line_after_open_tag
option: The formatter now intelligently determines when to add newlines after opening tags, eliminating the need for manual configuration. (by @azjezz in afa1b33) - Added
space_after_not_operator
option: This option allows you to add a space between the!
operator and the following expression (e.g.,! $foo
) for improved readability. (by @azjezz in #101)
Other Changes
- Fixed various formatting issues to ensure consistent and correct output for different code structures. (by @azjezz in #102, #103, #104, #105, #106, #107)
This release streamlines the formatter and improves its accuracy.
A big thank you to @innocenzi for all the suggestions and bug reports in #100 and #99 that helped make this release possible! 🙏
Enjoy! 🎉
Full Changelog: 0.15.0...0.16.0
Mago 0.15.0
This release of Mago focuses on improving the developer experience (DX) with a new initialization command, enhanced configuration options, and bug fixes.
New Features
-
mago init
command: Effortlessly set up Mago for your project with the new interactivemago init
command! This command guides you through the essential configuration options, including source paths, external dependencies, PHP version, and framework plugins. It can even detect and use settings from yourcomposer.json
file. This makes getting started with Mago a breeze! ✨ -
Global options: We've added several new global options to give you more control over Mago's behavior:
--config
: Specify the path to yourmago.toml
configuration file.--php-version
: Override the PHP version used for parsing and analysis.--threads
: Control the number of threads used for linting and formatting.--allow-unsupported-php-version
: Allow the use of unsupported PHP versions (use with caution!).--workspace
: Define the workspace directory for your project. This also influences where Mago looks for the configuration file.
These options can be used with any Mago command and must be specified before the command (e.g.,
mago --workspace my-project lint
).
Bug Fixes
- Token Precedence: Fixed a bug in the
mago-token
crate where the precedence of[
was incorrectly set, causing issues with parsing certain expressions.
Other Changes
- Improved Test Coverage: Added more test cases for the formatter to ensure better code quality and prevent regressions.
This release makes Mago even more user-friendly and reliable. We hope you enjoy the new features and improvements!
Full Changelog: 0.14.0...0.15.0
Maog 0.14.0
Formatter Enhancements 🛠️
-
Stdin input support:
You can now use mago fmt --stdin-input to format code provided via stdin and output the result to stdout. This enables seamless integration with various editors and tools, streamlining your workflow. Check out our updated docs for editor integration recipes with Zed and VS Code: -
Improved comment handling: The formatter now handles comments inside and around call argument lists more effectively, ensuring that comments are preserved and formatted correctly.
## Linter Improvements 🔍
@mago-expect
comments: Introducing@mago-expect
comments as a recommended alternative to@mago-ignore
comments. While@mago-ignore
completely silences the linter,@mago-expect
allows the linter to still scan the code and verify that the expected issue is present. This helps prevent unintended issues from being suppressed and promotes more reliable code analysis.comment/use-expect-instead-of-ignore
rule: This new rule recommends using@mago-expect
comments instead of@mago-ignore
comments, guiding you towards better linting practices.
Bug Fixes 🐛
- CRLF handling on Windows: Fixed an issue where CRLF line endings were not handled correctly on Windows, leading to mixed line endings and other formatting inconsistencies.
This release makes Mago an even more powerful and versatile tool for PHP code styling and analysis. We hope you enjoy the new features and improvements! 🎉
Full Changelog: 0.13.1...0.14.0
Mago 0.13.1
This is a quick hotfix release to address a regression in the mago_casing crate that was introduced in 0.13.0.
Bug Fixes 🐛
- Fixed incorrect casing for class names: In version 0.13.0, mago_casing was modified to support numbers within class names. However, this change inadvertently introduced a bug that allowed class names to start with a lowercase character. This has been corrected to ensure that class names are correctly cased according to the PSR-12 coding standard.
Build Fixes 🏗️
- Restored missing builds: Due to the regression in mago_casing, the 0.13.0 release was missing builds for macOS arm, Linux x86, Windows x86, and WASM. These builds have been restored in this release.
Full Changelog: 0.13.0...0.13.1
Mago 0.13.0
This release of Mago focuses on enhancing the formatter, improving the linter, and refining the CLI.
Formatter Enhancements 🛠️
- Fluent member access chains: The formatter now supports fluent member access chains, allowing for more concise and readable formatting of alternating property access and method calls. (by @azjezz in #90)
- Expanded member access chain handling: The formatter now handles both property accesses and method calls in member access chains, providing more consistent and comprehensive formatting. (by @azjezz in #91)
- Hugging single instantiation arguments: The formatter now "hugs" single instantiation arguments in function calls, resulting in more compact and readable code. (by @azjezz in #92)
- Expanding last instantiation argument: The formatter now expands the last instantiation argument in a function call if it has multiple named arguments, improving readability for complex expressions. (by @azjezz in #93)
- Enhanced member access chain printing conditions: Refined the conditions for printing member access chains to improve formatting consistency. (by @azjezz in
ff86425
) - Removed
method_chain_break_threshold
option: This option is no longer needed due to other improvements in method chain formatting. (by @azjezz in048fac1
) - Expanding first argument if it's an array: The formatter now expands the first argument in a function call if it's an array, improving readability for complex expressions. (by @azjezz in
1718a97
)
Linter Improvements 🔍
- New strictness rules: Added new rules to the strictness plugin to help prevent loose comparison and type juggling issues, promoting stricter and more predictable code. (by @vvvinceocam in #84)
- Panic on parse errors in tests: Improved the linter's test suite by panicking when a test case contains a parse error, ensuring that test cases are valid. (by @azjezz in
cc3dca5
)
CLI Refinements 🖥️
- Deprecated
fix
command: Thefix
command has been deprecated in favor oflint --fix
, simplifying the CLI and reducing redundancy. (by @azjezz in10d2abb
)
Other Changes
- Fixed parsing assignment expressions: Resolved an issue with parsing assignment expressions nested within binary expressions. (by @azjezz in
8a94457
) - Fixed formatting binaryish expressions: Improved the formatting of binary expressions to handle certain edge cases correctly. (by @azjezz in
6ccd95d
) - Fixed printing while loop condition: Corrected the printing of while loop conditions to ensure accurate formatting. (by @azjezz in
b3143d4
) - Fixed inlining parameter attributes: Resolved an issue with inlining parameter attributes in function definitions. (by @azjezz in
d48547a
) - Allowed mixed numeric-lowercase chars in class-name prefixes: Updated casing rules to allow mixed numeric and lowercase characters as part of a class name prefix. (by @azjezz in
b8ebdbc
)
This release includes a wide range of improvements and bug fixes for both the formatter and linter, making Mago an even more powerful tool for PHP code styling and analysis. Enjoy! 🎉
Full Changelog: 0.12.0...0.13.0
Mago 0.12.0
New Features 🆕
- Fine-grained parentheses control: You can now fine-tune how Mago handles parentheses in your code with three new options:
parentheses_around_new_in_member_access
: Decide whether to include parentheses around instantiation expressions followed by a member access operator (->
). This option is disabled by default, aligning with the streamlined style introduced in PHP 8.4. (#89)parentheses_in_new_expression
: Control whether to include parentheses innew
expressions, even when no arguments are provided. Enabled by default for explicitness. (#89)parentheses_in_exit_and_die
: Choose whether to include parentheses inexit
anddie
constructs, making them resemble function calls. Enabled by default for consistency. (#89)
- Space control in enums: The
space_before_enum_backing_type_hint_colon
option lets you control whether a space is added before the colon in enum backing type hints (e.g.,enum Foo: int
). (#88) - Trailing close tag removal: The
remove_trailing_close_tag
option allows you to control whether the trailing?>
tag is removed from PHP files. (#87)
Formatting Enhancements 🪄
- Improved consistency: We've tackled inconsistencies in formatting various code constructs, including comments, arrays, assignments, binary expressions, and more! (#85)
- Better wrapping: Mago now handles edge cases in wrapping more effectively, ensuring consistent and predictable output. (#85)
- Enhanced width calculation: We've refined the width calculation logic to accurately measure the width of strings, leading to more precise formatting. (#85)
- Use statement organization: Gain more control over use statement formatting with options to sort, expand, and separate them. (#83)
Bug Fixes 🐛
- PHP in HTML alignment: Fixed an issue where indented PHP code within HTML was not aligned correctly. (#85)
- Trailing newline removal: Resolved inconsistent removal of trailing newlines when removing the closing tag. (#87)
Breaking Changes ⚠️
- PHP version requirement: The
format()
function now requires aPHPVersion
argument. This change is necessary to support theparentheses_around_new_in_member_access
option, which has version-specific behavior. (#89)
We hope you enjoy these improvements to the Mago formatter! 🎉
Full Changelog: 0.11.1...0.12.0