Skip to content

Releases: carthage-software/mago

Mago 0.8.1

01 Feb 20:09
d3d0c79
Compare
Choose a tag to compare

🐞 Bug Fixes

Type Hint Compatibility

  • Fixed incorrect version checks for null and false type hints:
    • Previously: Reported as PHP 8.2+ features
    • Now: Correctly allows null and false in union types for PHP 8.0+

Thanks to @Nadyita for reporting #65

✨ New Features

GitLab Issue Reporting

  • Added support for GitLab-compatible issue reporting:
    mago lint --reporting-format=gitlab  

Thanks to @vvvinceocam for the contribution #62


Thank you for your feedback and contributions! 🚀


Full Changelog: 0.8.0...0.8.1

Mago 0.8.0

01 Feb 13:26
d1851d8
Compare
Choose a tag to compare

🚨 Breaking Changes

Removed compatibility Plugin

  • The compatibility plugin has been removed as its functionality is now integrated into the core semantics analyzer.

Strict PHP Version Checks

  • New: The semantics analyzer now enforces strict PHP version compatibility.
    • Detects usage of PHP features not available in the configured version
    • Always results in an error (cannot be disabled or downgraded)
    • Covers more features than the old plugin, ensuring stricter compliance

✨ New Features

PHP 8.5 Support

  • Added support for new PHP 8.5 features:
    • Closures in constant expressions
    • Attributes on constants ( #64 )

Thank you for using Mago! 🚀


Full Changelog: 0.7.0...0.8.0

Mago 0.7.0

31 Jan 02:18
893e634
Compare
Choose a tag to compare

🎯 Focused Update: WASM Overhaul

This release delivers a complete rewrite of the mago_wasm crate to empower web-based PHP tooling:

Key Improvements

  • Linter Integration: Full support for running Mago's PHP linting rules in WASM environments
  • Developer Experience: Simplified API surface with intuitive entry points and error handling
  • Documentation: Revamped Rust docs with usage examples and type-safe interfaces

Note: This is a breaking change for WASM consumers – see docs for migration guidance.

Mago 0.6.2

29 Jan 23:42
9b59274
Compare
Choose a tag to compare

Bug Fixes

  • Fixed Non-Zero Exit Code for Warnings/Notes:
    In version 0.6.1, we fixed the exit code behavior to ensure mago lint exits with a non-zero code when errors are present. However, this inadvertently caused the command to exit with a non-zero code even when only warnings, notes, or help messages were present. This has now been fixed.
    Fix: Replaced the logic level <= Level::Error with the cleaner has_minimum_level(Level::Error) method, which correctly checks if any issues meet or exceed the error level.
    Impact: The CLI now correctly exits with a non-zero code only when errors are present, allowing warnings, notes, and help messages to pass without failing the linting process.

How to Upgrade

  • If you installed Mago using the pre-built binary, the install script, or Homebrew, run:
    mago self-update
  • If you are using Composer, run:
    composer require carthage-software/mago:^0.6.1 --dev
  • If you are using Cargo, run:
    cargo install [email protected]

Why This Matters

This fix is critical for users relying on mago lint in automated workflows, such as CI/CD pipelines, where a non-zero exit code is expected when linting errors are found. Without this fix, pipelines could incorrectly proceed despite linting failures, potentially allowing insecure or problematic code to be deployed.

Thank You

We appreciate the community’s support in making Mago better. If you encounter any issues or have suggestions, please open an issue on GitHub.

Happy linting! 🚀

Mago 0.6.1

29 Jan 22:48
87fbf7b
Compare
Choose a tag to compare

Bug Fixes

  • Fixed Exit Code Behavior:
    The mago lint command now correctly exits with a non-zero status code when linting errors are detected. Previously, it would exit with a zero status code even when errors were present, which could mislead CI/CD pipelines or scripts into thinking the linting passed successfully.
    Impact: This ensures proper integration with automated workflows and prevents false positives in CI/CD pipelines.
    Thanks: A big thank you to @thyseus for reporting this issue in #61.

Tests

  • Regression Tests Added:
    Tests have been added to the mago_reporting crate to ensure the get_highest_level method in IssueCollection correctly identifies the highest severity level. The issue stemmed from the reversed order of the Level enum fields, which has now been fixed. These tests prevent future regressions.

How to Upgrade

  • If you installed Mago using the pre-built binary, the install script, or Homebrew, run:
    mago self-update
  • If you are using Composer, run:
    composer require carthage-software/mago:^0.6.1 --dev
  • If you are using Cargo, run:
    cargo install [email protected]

Why This Matters

This fix is critical for users relying on mago lint in automated workflows, such as CI/CD pipelines, where a non-zero exit code is expected when linting errors are found. Without this fix, pipelines could incorrectly proceed despite linting failures, potentially allowing insecure or problematic code to be deployed.

Thank You

We appreciate the community’s support in making Mago better. If you encounter any issues or have suggestions, please open an issue on GitHub.

Happy linting! 🚀


Full Changelog: 0.6.0...0.6.1

Mago 0.6.0

29 Jan 05:27
b8b736f
Compare
Choose a tag to compare

Mago 0.6.0 introduces new compatibility rules, enhanced CLI flexibility, a new security plugin, and expanded functionality for the fix command.


🛠 New Compatibility Rules for PHP 8.2, 8.3, and 8.4

We've added new compatibility rules to detect and warn about features introduced in PHP 8.2, 8.3, and 8.4, helping you ensure your code runs on the intended PHP version.

PHP 8.2 Compatibility Rules:

  • compatibility/dnf-type-hint-feature – Detects usage of Disjunctive Normal Form (DNF) type hints.
  • compatibility/readonly-class-feature – Warns when using readonly classes before PHP 8.2.
  • compatibility/trait-constants-feature – Detects constants inside traits, which are only available in PHP 8.2.
  • compatibility/true-type-hint-feature – Ensures true as a type hint is used only in PHP 8.2+.

PHP 8.3 Compatibility Rules:

  • compatibility/typed-class-constant-feature – Detects usage of typed class constants, available in PHP 8.3.

PHP 8.4 Compatibility Rules:

  • compatibility/hooked-property-feature – Ensures hooked properties are only used in PHP 8.4+.
  • compatibility/new-without-parentheses-feature – Detects new expressions without parentheses, available from PHP 8.4.

👉 View details for each rule using:

mago lint --explain compatibility/readonly-class-feature

(Replace readonly-class-feature with any other rule name to learn more.)


🎛️ New CLI Options: --no-default-plugins & --plugins

We've improved the lint and fix commands with new flags to fine-tune which plugins are enabled.

  • --no-default-plugins (-n): Disables default plugins, overriding linter.default_plugins in your config.
  • --plugins (-p): Enables one or more specific plugins, overriding linter.plugins.

👉 Examples:

  • Run the linter with only the compatibility plugin:
    mago lint -n -p compatibility
  • List all rules from a specific plugin:
    mago lint -n -p compatibility --list-rules

🔐 New Security Plugin

Mago now includes a security plugin, which detects potential security vulnerabilities in your PHP code.

  • View all security rules:
    mago lint -n -p security --list-rules
    
  • Get details about a specific security rule:
    mago lint --explain security/<rule-name>
    

mago fix Now Accepts Paths

The mago fix command has been expanded to allow specifying paths, so you can apply fixes to a specific file or directory without affecting the entire project.

👉 Examples:

  • Fix issues in a single file:
    mago fix path/to/file.php
  • Fix only issues from the migration plugin in a specific directory:
    mago fix path/to/dir -n -p migration

🔥 Summary

Mago 0.6.0 gives you more control over linting and fixing, improves PHP compatibility checks, and introduces security rules to help safeguard your codebase.

Upgrade today and enjoy more power and flexibility in your PHP workflow! 🚀


Full Changelog: 0.5.1...0.6.0

Mago 0.5.1

28 Jan 01:43
f487ca9
Compare
Choose a tag to compare

We sincerely apologize for the issues encountered in v0.5.0. This hotfix addresses critical regressions:

Bug Fixes:

  • 🛠️ Configuration Loader: Fixed error when MAGO_LOG environment variable is unspecified
  • 📂 Source Loader: No longer attempts to load directories as files.

Mago 0.5.0

27 Jan 22:42
89c29c6
Compare
Choose a tag to compare

🚀 New Features

Enhanced Linting Targets

Run linting on specific files/directories or file descriptors:

# Lint single file
mago lint example.php

# Lint multiple files/directories
mago lint src/ tests/ example.php

# Lint via process substitution (Unix-like systems)
mago lint <(echo '<?php while(true) { break; }')

Type Checking Flexibility

Added ignore_closure_types option to skip parameter/return type checks for:

  • Arrow functions
  • Closures

For more information, use mago lint --explain strictness/require-parameter-type and mago lint --explain strictness/require-return-type

🐞 Bug Fixes

Critical Rule Fixes:

  • Fixed best-practices/loop-does-not-iterate to detect loops with unconditional continue (Resolves #55)
  • Fixed filtering behavior when using MAGO_LOG environment variable

Compatibility Improvements:

  • Made Composer plugin fully compatible with PHP 8.1 environments

🔧 Improvements

Diagnostics & Logging:

  • Revamped logging messages for clearer debugging sessions

⚙️ Internal Changes

  • Updated default Composer configuration templates
  • Optimized rule initialization sequence

What's Changed

  • Make composer plugin compatible with PHP 8.1 by @veewee in #56

Full Changelog: 0.4.1...0.5.0

Mago 0.4.1

24 Jan 21:31
92eb0a6
Compare
Choose a tag to compare

🛠 Bug Fixes

  • Strictness Plugin: Fixed a bug related to PHP version compatibility:
    • The linter incorrectly flagged constants as requiring types before PHP 8.3.
    • Other PHP version-related issues were reported without actionable fixes. These have been resolved for better version-aware linting.

📄 Documentation Updates

  • Added essential project documents:
    • Code of Conduct (CoC): Guidelines for maintaining a respectful and inclusive community.
    • Security Policy: Steps for reporting vulnerabilities to ensure Mago remains secure.
    • Contributing Guidelines: Clear instructions for contributing to the project.

🎉 Composer Plugin Enhancements

  • Expanded PHP version support for the Composer plugin:
    • Now supports PHP 8.1 and PHP 8.2 for improved compatibility and flexibility.

This patch focuses on improving PHP compatibility, addressing user-reported issues, and laying the foundation for smoother collaboration and security. Thanks for your continued support!

Mago 0.4.0

24 Jan 01:44
53c7f14
Compare
Choose a tag to compare

Mago 0.4.0 introduces new features, Composer integration, and significant internal refactoring. Here's what's new:


🚀 New Features

Compatibility Rule: arrow-functions-feature

The linter now includes the compatibility/arrow-functions-feature rule, which detects the use of arrow functions introduced in PHP 7.4. This helps ensure your code remains compatible with earlier PHP versions if needed.

Learn more about the rule using:

mago lint --explain compatibility/arrow-functions-feature

📦 Composer Package and Plugin

Mago can now be installed as a Composer package and plugin! This simplifies integration into PHP projects and allows you to manage Mago through Composer.

For more details, see the updated Installation Documentation.

⚠️ Internal Refactoring and BC Breaks

Significant internal refactoring has been done in the mago_ast crate, affecting its API and other crates relying on it.

Breaking Changes:

If you are directly using the mago_ast crate or any dependent crate, exercise caution when updating to 0.4.0, as there are backward-incompatible changes.

🤝 New Contributors


Thank you for your continued support! We’re excited to see how Mago helps you level up your PHP development workflow.


Full Changelog: 0.3.0...0.4.0