Releases: carthage-software/mago
Mago 0.22.1
Mago 0.22.1 🪄
This patch release addresses a critical bug in the formatter, ensuring correct handling of leading function-like comments.
🛠️ Bug Fixes
- Fixed Function-Like Header Formatting with Leading Comments 🐛 (#171):
- Resolved an issue where leading function-like comments were breaking the formatting of function-like headers (functions, methods, closures).
We recommend updating to this version to ensure consistent and accurate formatting.
Full Changelog: 0.22.0...0.22.1
Mago 0.22.0
Mago 0.22.0 🪄
This release brings a mix of new linter rules, formatter enhancements, and crucial bug fixes, improving both code quality analysis and formatting precision.
✨ New Features
- New
string-interpolation-braces
Linter Rule 🧱 (#168):- Enforces the use of curly braces around expressions within string interpolation for clarity and consistency.
- Empty Block Formatting Options 🧱 (#169):
- Fine-grained control over empty code block formatting:
- Control Structures (if, else, etc.):
inline_empty_control_braces
(Default:false
) - Closures:
inline_empty_closure_braces
(Default:true
) - Functions:
inline_empty_function_braces
(Default:false
) - Methods:
inline_empty_method_braces
(Default:false
) - Constructors:
inline_empty_constructor_braces
(Default:true
) - Classes/Traits/Interfaces:
inline_empty_classlike_braces
(Default:false
) - Anonymous Classes:
inline_empty_anonymous_class_braces
(Default:true
)
- Control Structures (if, else, etc.):
- Fine-grained control over empty code block formatting:
- Auto-fix for
require_strict_types
Linter Rule 🛠️ (#147):- Automatically adds
declare(strict_types=1);
to PHP files, simplifying strict type enforcement.
- Automatically adds
🛠️ Bug Fixes
- Improved Attribute Formatting 🐛 (#166):
- Resolved multiple formatting issues related to attributes.
- Conditional Expression Line Break Fix 🐛:
- Corrected line break behavior in simple conditional expressions.
- Indirect Variable Identifier Parser Fix 🐛:
- Addressed a parsing error with identifiers in indirect variable expressions.
🎉 First-Time Contributor
- @innocenzi made their first contribution in #147
We hope you enjoy the improvements!
Full Changelog: 0.21.0...0.22.0
Mago 0.21.0
Mago 0.21.0
We are excited to announce the release of 0.21.0
, which includes several new features, bug fixes, and improvements to enhance your development experience.
New Features
- Linting with Auto-Formatting:
- Introduced the
--format
(or--fmt
) option tomago lint --fix
. This feature automatically formats files after linting fixes are applied, streamlining your workflow.
- Introduced the
- Shell-Style Comment Conversion:
- The formatter now converts shell-style comments (
#
) into double-slash (C-style) comments (//
). This improves consistency and compatibility.
- The formatter now converts shell-style comments (
- Improved Argument Expansion:
- Enhanced argument expansion for function calls, specifically improving the formatting of the first and last arguments when they are function calls themselves.
Bug Fixes
- Formatter Regressions:
- Addressed regressions in the formatter affecting the PSL codebase.
- Fixed regressions in member access formatting.
- Ensured the formatter no longer trims whitespace at the end of string parts.
- CLI Improvements:
- Removed the deprecated
fix
command, directing users to uselint --fix
instead.
- Removed the deprecated
Enhancements
- Overall improvements to the formatter's argument expansion logic.
This release addresses issues #156, #162, #163, and #164, and provides a more seamless linting and formatting experience.
Full Changelog: 0.20.4...0.21.0
Mago 0.20.4
Mago 0.20.4
We are releasing 0.20.4
to address a critical lexer bug related to invalid base number prefixes.
Bug Fixes
- Lexer: Correctly handle invalid base number prefixes:
- Fixed an issue where invalid base number prefixes (0x, 0b, 0o) without subsequent digits were incorrectly tokenized as integers. These are now correctly tokenized as a literal integer "0" followed by an identifier (e.g., "x", "b", "o"). This prevents downstream panics and incorrect parsing.
Full Changelog: 0.20.3...0.20.4
Mago 0.20.3
Mago 0.20.3
We are releasing v0.20.3 to address several formatting bugs and enhance array table support within the formatter.
Bug Fixes and Enhancements
- Array Table Support: Expanded support for elements allowed in array tables, improving formatting for complex array structures.
- String Width Calculation: Fixed string width calculation to use Unicode width, ensuring accurate handling of multi-byte characters.
- Idempotency: Addressed idempotency issues with breaking argument lists and member access chains, ensuring consistent formatting across multiple runs.
- General Improvements: Code cleanup, refactoring, and enhanced fluent access chain detection.
This release addresses issues #159, #160, and #161, improving the overall robustness and accuracy of the formatter.
Full Changelog: 0.20.2...0.20.3
Mago 0.20.2
Mago 0.20.2
We are releasing 0.20.2
to address a critical idempotency issue in the formatter's handling of conditional expressions (ternary operators).
Bug Fixes
- Formatter:
- Fixed an issue where conditional expressions were being formatted inconsistently across multiple formatter runs. This non-idempotent behavior caused code to be formatted differently with each execution, leading to unnecessary diffs.
- This fix ensures that the formatter produces consistent output for conditional expressions, resolving issue #157.
We recommend all users update to 0.20.2
to ensure idempotent formatting of conditional expressions.
Full Changelog: 0.20.1...0.20.2
Mago 0.20.1
Mago 0.20.1
We are releasing 0.20.1
to address a critical bug in the formatter related to heredoc and nowdoc string handling.
Bug Fixes
- Formatter:
- Fixed an issue where the formatter was incorrectly removing leading whitespace within heredoc/nowdoc strings when expressions preceded the literal content.
- Previously, when a heredoc/nowdoc contained an expression followed by a literal part, the formatter would incorrectly strip leading whitespace from the literal, altering the intended string content.
- For example:
would incorrectly become:
$a = <<<FOO {$bar} Hello FOO;
$a = <<<FOO {$bar}Hello FOO;
- This release corrects this behavior, ensuring that leading whitespace is preserved in literal parts of heredoc/nowdoc strings, as long as they are preceded by content other than a newline.
We recommend all users update to v0.20.1 to ensure correct formatting of heredoc and nowdoc strings.
Full Changelog: 0.20.0...0.20.1
Mago 0.20.0
Mago 0.20.0 🪄
We are excited to announce the release of 0.20.0, which brings significant enhancements to the formatter, along with several bug fixes and improvements to the linter and project functionalities.
✨ New Features
- Extensive Spacing Control Options:
- This release introduces over 60 new configuration options for fine-grained control over spacing within your PHP code. Users can now customize spacing around parentheses in control structures, function declarations, calls, lists, arrays, unary and binary operators, colons, semicolons, nullable and intersection type hints, and more.
- These options allow for precise adjustments to spacing, enabling users to adhere to specific style guides or personal preferences, significantly improving code readability.
- Empty Line Control Options:
- New configuration options have been added to control the insertion of empty lines after various language constructs. This includes options for control structures (if, for, foreach, while, do, switch), opening tags, declare statements, namespaces, use statements, symbols (classes, enums, interfaces, traits, functions, constants), class-like constants, enum cases, trait uses, properties, methods, return statements, and dangling comments.
- These options provide greater control over vertical spacing, enhancing code readability and customization.
🛠️ Bug Fixes
- Linter:
- Corrected the logic for locating applicable pragmas for nodes, resolving issue #142.
- Fixed a false-positive issue with unused parameter detection, resolving issue #148.
- Disabled the
best-practices/no-boolean-literal-comparison
rule by default, addressing issue #129. - Enabled all linter rules with error level during tests.
- Project:
- Fixed the auto-implementation of the
Stringable
interface.
- Fixed the auto-implementation of the
We encourage users to update to 0.20.0 to take advantage of these new features and improvements. Thank you for your continued support!
Full Changelog: 0.19.5...0.20.0
Mago 0.19.5
Mago 0.19.5 🛠️
Bug Fixes & Improvements:
- Improved Array Formatting with Comments: Enhanced array formatting to automatically break arrays into multiple lines when comments are present between elements. This significantly improves readability, especially in complex array definitions.
Full Changelog: 0.19.4...0.19.5
Mago 0.19.4
Mago 0.19.4 🛠️
Bug Fixes & Improvements:
This patch release addresses several formatting bugs and improves the overall formatting logic.
- Statement Termination Logic: Corrected the logic for determining if a statement terminates scripting, particularly for
Declare
,For
,Foreach
,While
, and If statements with colon-delimited bodies. Also,HaltCompiler
is now correctly handled. - Assignment Formatting: Improved the logic for breaking after assignment operators, preventing unnecessary breaks in certain cases.
- Class-like Body Formatting: Refactored class-like body formatting to improve spacing and handle empty lines correctly between members.
- Terminator Formatting: Adjusted the formatting of
ClosingTag
terminators to add a space before the tag. - Statement Spacing: Enhanced the logic for adding spaces and newlines between statements, especially for
OpeningTag
statements. - Printer Logic: Corrected the handling of
LineSuffixBoundary
in the printer, ensuring correct spacing and line breaks. - HTML Template Formatting: Fixed an issue with comment placement in HTML templates, ensuring comments are correctly placed after PHP tags.
These changes address and close the following issues: #150, #138, #149, #151.