github carthage-software/mago 0.6.0
Mago 0.6.0

latest releases: 1.0.0-beta.17, 1.0.0-beta.16, 1.0.0-beta.15...
7 months ago

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

Don't miss a new mago release

NewReleases is sending notifications on new releases.