Skip to content

Releases: carthage-software/mago

Mago 0.0.17

29 Dec 20:40
045fd25
Compare
Choose a tag to compare

Mago 0.0.17 is a minor release focusing on refining the descriptions of commands, arguments, and flags in the command-line interface (CLI). These updates enhance clarity and consistency, making the CLI more intuitive and user-friendly. While there are no functional changes, this release ensures a smoother experience for users navigating Mago's features.

Mago 0.0.16

29 Dec 20:05
e12e99d
Compare
Choose a tag to compare

Mago 0.0.16 introduces significant enhancements, new features, and improvements to the PHP toolchain, further refining the developer experience. Here's what's new:

🎉 New Features

Deterministic Formatter Testing

  • Added deterministic testing for the formatter to ensure formatted code, when re-formatted, remains unchanged. This guarantees stable and predictable results across multiple formatting runs.

New CLI Options

  • mago lint --semantics-only: Perform a quick check for semantic correctness without invoking linter rules. Ideal for rapid validation of code correctness.

New Linter Rules

  • analysis/inheritance: Detects issues with class inheritance, ensuring valid and proper usage of parent classes and interfaces.
  • analysis/instantiation: Identifies problems in instantiation nodes, such as using new Foo when Foo does not exist, is abstract, or has a private constructor.

🛠 Improvements

Formatter Logic Overhaul

  • Completely re-implemented formatting logic for assignment and binary operations, ensuring consistency and predictability. This update provides a more intuitive formatting experience for these node types.

Documentation

Launched the official documentation site: https://mago.carthage.software/.

Includes guides on installation, configuration, CLI usage, and detailed explanations of formatter and linter settings.

Miscellaneous Changes

Various small tweaks and refinements to enhance usability and performance.

Mago 0.0.15

23 Dec 01:52
df1b8b0
Compare
Choose a tag to compare

🛠 Bug Fixes

Linter Improvements

  • Property Type Hint Awareness
    • Fixed an issue where the linter incorrectly flagged properties as missing type hints, even when they were inherited from a parent class. The linter now understands inheritance and won’t bug you unnecessarily!

Configuration Handling

  • exclude Entry in Config
    • Resolved an issue where exclude entries in the [source] section of the config were mishandled:
      • Entries with * are now properly treated as glob patterns.
      • Absolute paths are matched directly, while relative paths are joined with the root directory.

Source Loading

  • Fixed a problem where files in include were incorrectly treated as user-defined files if the include directory was inside the paths directory.
    • Example: With paths = ["src"] and includes = ["src/external-library"], src/external-library is now correctly recognized as external code.

Formatter Fixes

  • Unary Operations with Parentheses
    • Fixed an issue where parentheses around unary operations on the left-hand side of binary operations were removed, causing execution order changes.
    • Example:
      • Previously: (@include $foo) === false@include $foo === false (incorrect).
      • Now: Parentheses are preserved to maintain correct order.

🌟 Community Contributions

Special thanks to Ben Davies (@bendavies) and Giorgio Pogliani (@giorgiopogliani) for reporting these issues and testing Mago.
Your support helps us make Mago better!


Full Changelog: 0.0.14...0.0.15

Mago 0.0.14

22 Dec 21:33
3143409
Compare
Choose a tag to compare

We are thrilled to unveil Mago v0.0.14, a groundbreaking update that takes Mago to the next level! This release introduces reflections, smarter linting, and critical bug fixes.

🚀 New Features

Reflections and Built-in PHP Type Awareness

  • Mago is now aware of all PHP built-in types, thanks to JetBrains/phpstorm-stubs.
  • Reflections enable Mago to analyze and understand your entire codebase, including built-in PHP types, user-defined code, and dependencies.

New Analysis Linter Plugin

  • Undefined Functions Rule: Detects and notifies you about calls to undefined functions.
  • Undefined Constants Rule: Identifies the usage of undefined constants.
  • These rules are just the beginning! Reflections pave the way for detecting runtime errors statically, with planned rules for inheritance and other advanced analysis.

Smarter Linter Suggestions

  • Mago’s linter is now smarter and more context-aware:
    • It will no longer suggest renaming parameters or adding types to parameters inherited from a class or interface, avoiding potential inheritance-breaking changes.

Improved Analysis with Composer

  • To get the best results, include your vendor directory in your configuration file (excluding composer files). Example:
[source]
paths = ["src"]
includes = ["vendor"]
excludes = ["*/vendor/composer/*"]

🐛 Bug Fixes

Lexer Fixes

  • Recognizes callable as a keyword.
  • Correctly parses heredoc when a line starts with the label text (e.g., PHPDOC in the example below).
$a = <<<PHP

PHPDOC <-- no longer mistakenly considered as the closing label

PHP;

Linter Fixes

  • The implicit nullable parameter rule now fixes code correctly, preventing runtime issues.

Formatter Fixes

  • Parentheses are preserved in cases like new ($foo->bar())() to avoid errors.

🌟 Community Contributions

A huge shoutout to @bendavies (Ben Davies) for reporting many of these issues in our Discord. Your feedback and effort make Mago better for everyone!


What's Changed

Full Changelog: 0.0.13...0.0.14

Mago 0.0.13

21 Dec 02:25
b9aa4b7
Compare
Choose a tag to compare

Enhancements

  • Internal Refactoring

    • Various internal improvements to streamline performance and maintainability.
  • New Command: mago self-update

    • Easily update Mago to the latest version or check for updates without manual intervention.

Chores

  • Crates Removed

    • mago_cli and mago_services are no longer available.
  • Build Process Fixes

    • Resolved build issues across multiple targets, ensuring broader compatibility.

New Feature: One-Line Installation

Quickly install or update Mago with a simple script for macOS or Linux.

Installation Command

curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash
# or
wget -qO- https://carthage.software/mago.sh | bash

Full Changelog: 0.0.12...0.0.13

Mago 0.0.12

19 Dec 21:24
8ce888d
Compare
Choose a tag to compare

Enhancements

  • Linter Rules:
    • no-unsafe-finally

      • What it does: Prevents the use of return, throw, break, and continue within finally blocks in try statements.
      • Why it matters: Ensures code predictability and avoids unintended control flow behavior when finally executes.
    • no-multi-assignments

      • What it does: Disallows chained assignments like $a = $b = $c.
      • Why it matters: Improves code clarity and reduces the risk of bugs caused by unintended assignments.

Chores

  • Refactor ast-utils crate:
    • Details: Comprehensive refactor of the ast-utils crate.
    • Impact: This change introduces breaking changes (BC breaks), so ensure to review and adapt your projects accordingly when updating.

Expanded Build Target Support

We now support a broader range of targets in our build process, ensuring compatibility across diverse systems. Below is the updated list of supported targets:

Windows

  • MinGW
    • x86_64-pc-windows-gnu
  • MSVC
    - i686-pc-windows-msvc (tested)
    - x86_64-pc-windows-msvc (tested)

macOS

  • aarch64-apple-darwin (tested)
  • x86_64-apple-darwin (tested)

FreeBSD

  • i686-unknown-freebsd
  • x86_64-unknown-freebsd

Linux

  • aarch64-unknown-linux-gnu (tested)
  • arm-unknown-linux-gnueabi
  • arm-unknown-linux-gnueabihf
  • armv7-unknown-linux-gnueabihf
  • arm-unknown-linux-musleabi
  • arm-unknown-linux-musleabihf
  • armv7-unknown-linux-musleabihf
  • i686-unknown-linux-gnu (tested)
  • i686-unknown-linux-musl (tested)
  • powerpc-unknown-linux-gnu
  • powerpc64-unknown-linux-gnu
  • powerpc64le-unknown-linux-gnu
  • s390x-unknown-linux-gnu
  • x86_64-unknown-linux-gnu (tested)
  • x86_64-unknown-linux-musl (tested)

Full Changelog: 0.0.11...0.0.12

Mago 0.0.11

18 Dec 22:33
224b9ed
Compare
Choose a tag to compare

Mago 0.0.10

18 Dec 19:56
fb3819b
Compare
Choose a tag to compare

Mago 0.0.9

15 Dec 15:26
986b587
Compare
Choose a tag to compare

New Features

  • Linter Command:

    --reporting-target:

    Allows specifying the output target for issue reports.

    • Default: stdout
    • Options:
      • stdout: Outputs to standard output.
      • stderr: Outputs to standard error.

    --reporting-format:

    Allows selecting the format for issue reports.

    • Default: rich
    • Options:
      • rich: Detailed output for terminal display.
      • medium: Compact, terminal-friendly format.
      • short: Minimal output, useful for quick overviews.
      • github: Tailored for GitHub Actions annotations.
      • json: Structured JSON output for machine-readable reports.

Full Changelog: 0.0.8...0.0.9

Mago 0.0.8

14 Dec 18:45
9e62819
Compare
Choose a tag to compare

Enhancements

  • Linter:

  • Introduce Laravel Plugin: Adds a new Laravel-specific plugin with an initial rule detecting Request::all() usage and suggesting Request::only(...) instead. Enable it with:

    [linter]
    plugins = ["laravel"]

    Future plans include adding more Laravel-specific rules.

  • Add Combine Consecutive Issets Rule: Transforms isset($a) && isset($b) into the more concise isset($a, $b).

  • Introduce Migration Plugin: Adds two migration rules:

    1. Convert strpos($a, $b) == 0 to str_starts_with($a, $b)
    2. Convert strpos($a, $b) != false to str_contains($a, $b)
      More PHP migration rules are planned for future releases.
  • Add Explicit Octal Notation Rule: Part of the migration plugin, converts old-style octal notation (e.g., 012) to the more explicit 0o12 for improved readability.

  • Add Readonly Class Promotion Rule: Transforms classes with only readonly properties into a readonly class, removing individual readonly modifiers for cleaner code.

  • Introduce Deprecation Plugin: Detects PHP deprecations with two initial rules:

    1. Convert implicitly nullable params string $a = null to explicitly nullable ?string $a = null (deprecated in PHP 8.4)
    2. Identify and suggest renaming class-like nodes named _ (deprecated in PHP 8.4)
  • Add PHP 8.0 and 8.2 Deprecation Rules:

    1. Detect optional parameters before required ones (deprecated in PHP 8.0)
    2. Identify return by reference from void functions/methods/closures (deprecated in PHP 8.2)

Fixes


Full Changelog: 0.0.7...0.0.8