github carthage-software/mago 1.0.0-alpha.9
Mago 1.0.0-alpha.9

latest releases: 1.0.0-beta.10, 1.0.0-beta.9, 1.0.0-beta.8...
23 days ago

This release is all about polish! ✨ We've focused heavily on stabilizing and refining the code formatter, squashing a host of community-reported bugs to make the output cleaner, more predictable, and more aesthetically pleasing.

A big thank you to everyone who contributed by reporting issues!


💅 Formatter Polish

This release introduces a significant number of improvements to the code formatter, targeting consistency, comment handling, and smarter line breaking.

  • Smarter Parentheses: The logic for adding parentheses has been completely overhauled. The formatter now uses a more robust, precedence-based system instead of a complex set of specific rules. This change eliminates many unnecessary parentheses that were previously added around binary, ternary, and unary cast expressions, leading to cleaner, more minimal code.

  • Improved Argument Lists & Comments: Formatting for function calls, especially those containing comments or nested calls, is now much more reliable. We've fixed issues with "dangling" comments (e.g., those between a ( and the first argument) and improved the inlining logic to prevent ugly, deeply-indented code for nested function calls.

  • Consistent Line Breaking: Several bugs that caused inconsistent or awkward line breaks have been fixed. Binary expressions used as values in assignments (e.g., 'key' => $a ?: match{...}) and multi-line logical expressions with comments are now formatted correctly and predictably.

  • Idempotency Fixes: Formatting the same file multiple times is now more stable. We've resolved issues with inconsistent spacing before closing tags (?>) and incorrect formatting of comments between if/else blocks to ensure the output is the same every time.


⚙️ Other Fixes & Improvements

Beyond the formatter, this release also includes fixes for the type system and internal refactoring for better maintainability.

  • Type Syntax:

    • Union types with negated literals (e.g., @param -1|string $a) are now parsed correctly.
    • Type error messages have been enhanced to include the original raw type string that caused the error, making it significantly easier to find and debug invalid docblock annotations.
  • Analyzer Internal Refactoring:

    • We've done some internal housekeeping by centralizing context creation in the analyzer and removing duplicated code, improving the overall health and maintainability of the project.

Closed Issues

This release closes the following issues:


Full Changelog: 1.0.0-alpha.8...1.0.0-alpha.9

Don't miss a new mago release

NewReleases is sending notifications on new releases.