github carthage-software/mago 1.0.0-beta.25
Mago 1.0.0-beta.25

12 hours ago

Mago 1.0.0-beta.25

This release is packed with significant formatter improvements, fixing a large number of regressions and introducing a new, smarter
heuristic for builder patterns. The analyzer also continues to get more accurate, with major correctness fixes for traits and magic methods.

💅 Formatter

This release addresses many long-standing formatting issues and regressions, resulting in much more stable and beautiful output for complex, real-world code.

  • New Builder Pattern Formatting: The formatter now automatically detects and breaks method chains that follow a "builder pattern" (e.g., in the Symfony Form Builder), enforcing a highly readable style.
  • Regression Fixes: Numerous bugs have been fixed, restoring correct and intuitive formatting for:
    • Nested function calls with complex, multi-line arguments (#495).
    • Preserving indentation in manually broken method chains when using preserve-breaking-member-access-chain (#503).
    • Handling comments placed before binary operators in multi-line expressions (#344).

🚀 Analyzer

The analyzer's accuracy for complex object-oriented patterns has been significantly improved.

  • Trait & @method Support: The analyzer now correctly handles pseudo methods (@method) defined on traits, making them inheritable by the classes that use them. It also no longer reports false errors when a @method tag is used to provide a more specific type for a real method. (#491, #500)
  • Template Inference Fix: A bug that caused incorrect type inference for generic functions like array_shift() when used with mixed inputs has been resolved, eliminating a class of false positives. (#498)
  • PSL Support: Improved support for Psl\Type\shape and added support for Psl\Type\optional function. (#501)
  • New Check: redundant-var-docblock: A new analyzer check has been added to flag @var docblocks that are redundant with a native property type. (#502)

✨ Linter

  • New Rule: sensitive-parameter: A new security rule, security/sensitive-parameter, has been added. It detects parameters with sensitive names (e.g., $password, $token) and reports an error if they are missing the #[SensitiveParameter] attribute. This rule includes an auto-fix.
  • New Policy: Rules Disabled by Default: To improve stability for existing users during the beta period, all new linter rules will now be disabled by default. This prevents new releases from breaking CI pipelines. Users can opt-in to new rules via their mago.toml.

Full Changelog: 1.0.0-beta.24...1.0.0-beta.25

Don't miss a new mago release

NewReleases is sending notifications on new releases.