Skip to content

Releases: carthage-software/mago

Mago 0.23.0

13 Apr 16:43
427f12e
Compare
Choose a tag to compare

Mago 0.23.0 🪄

This release brings significant internal refactoring and key enhancements, primarily focused on improving the architecture and capabilities of Mago's syntax processing and CLI functionality.

Key Changes:

  • Refactored Syntax Processing Crates (#179):

    • Consolidated the functionality of several smaller crates (mago_ast, mago_token, mago_lexer, mago_parser, mago_walker, mago_ast_utils) into a single, unified crate named mago_syntax. This simplifies dependency management and reflects the common usage patterns of these components.
    • Introduced a new crate, mago_type_syntax, dedicated to parsing PHP docblock type strings. This provides a reusable component for tools needing to understand docblock types.
    • Created a new utility crate, mago_syntax_core, to hold common, low-level components shared between different lexing/parsing tasks, reducing code duplication.
    • BREAKING CHANGE: This refactor includes significant changes to the public API of the affected crates. Users may need to adapt to the new crate structure and types.
  • Improved Linter Rule:

    • The strictness/require-strict-behavior rule now allows dynamic strictness, enabling more flexible control over strict behavior enforcement.
  • Improved CLI --exclude Option Handling (#180):

    • The --exclude CLI option and the source.excludes configuration setting now correctly handle relative paths.
    • Specifically, if an exclusion pattern starts with ./, it is replaced with the workspace directory, ensuring that exclusions work as expected when Mago is run from different locations within a project.

We hope these changes improve the performance, reliability, and usability of Mago.


Full Changelog: 0.22.2...0.23.0

Mago 0.22.2

05 Apr 07:57
35f62e0
Compare
Choose a tag to compare

Mago 0.22.2 🪄

This release introduces a new filtering option for the mago lint command and adds more flexibility to the strictness/require-strict-behavior rule.

✨ New Features

  • Linter: --minimum-level option: The mago lint command now accepts a --minimum-level option. This allows you to filter linting results based on the severity level. You can specify info, help, warning, or error. If any issue with the specified or higher severity level is found, the command will exit with a non-zero code. This is useful for configuring CI pipelines to fail on warnings, for example (#174) by @Zuruuh.

🛠️ Enhancements

  • strictness/require-strict-behavior rule: Added the allow-loose-behavior option to this rule. When enabled, the rule allows explicitly disabling strict behavior in functions that support it by passing false as the $strict parameter. By default, the rule still enforces using strict behavior.

We hope these changes improve your linting experience and provide you with more control over your code analysis workflow.


Full Changelog: 0.22.1...0.22.2

Mago 0.22.1

24 Mar 22:07
f123323
Compare
Choose a tag to compare

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

23 Mar 17:25
22be4f6
Compare
Choose a tag to compare

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)
  • Auto-fix for require_strict_types Linter Rule 🛠️ (#147):
    • Automatically adds declare(strict_types=1); to PHP files, simplifying strict type enforcement.

🛠️ 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


We hope you enjoy the improvements!


Full Changelog: 0.21.0...0.22.0

Mago 0.21.0

22 Mar 04:46
9c931fc
Compare
Choose a tag to compare

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 to mago lint --fix. This feature automatically formats files after linting fixes are applied, streamlining your workflow.
  • Shell-Style Comment Conversion:
    • The formatter now converts shell-style comments (#) into double-slash (C-style) comments (//). This improves consistency and compatibility.
  • 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 use lint --fix instead.

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

18 Mar 19:44
54a5f22
Compare
Choose a tag to compare

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

18 Mar 16:21
a82e80f
Compare
Choose a tag to compare

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

14 Mar 20:58
Compare
Choose a tag to compare

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

14 Mar 12:23
acd8a77
Compare
Choose a tag to compare

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:
      $a = <<<FOO
      {$bar}            Hello
      FOO;
      would incorrectly become:
      $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

13 Mar 10:11
cd709fe
Compare
Choose a tag to compare

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.

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