github carthage-software/mago 1.2.0
Mago 1.2.0

latest release: 1.2.1
10 hours ago

First of all, I want to apologize for the delayed release — I've been on a break the past couple of weeks. Thank you all for your patience! 🙏

This release brings significant improvements to the analyzer, including unused code detection, better type inference, and numerous bug fixes addressing false positives reported by the community.

✨ Features

Analyzer

  • Unused code detection: Mago now detects unused private methods and properties (#867, #929)
  • Write-only property detection: Detect private properties that are written to but never read
  • Undefined type reference errors: Report errors when referencing classes, interfaces, enums, or type aliases that don't exist (#891)
  • Symbol namespace tracking: Keep track of symbol namespaces for improved import validation

Linter

  • no-isset rule: New rule to prevent usage of the isset construct (#924) by @djschilling
  • Redundant import detection: Detect redundant same-namespace and root-namespace imports in no-redundant-use rule (#921)
  • Auto-fixers for lowercase-type-hint and lowercase-keyword: New fixers for these linter rules (#911) by @dotdash

Configuration

  • Distribution config files: Add support for loading mago.dist.toml and mago.dist.json files (#903) by @Bleksak

Formatter

  • Inline abstract property hooks: New inline-abstract-property-hooks setting for PER-CS 4.10 compliant property hook formatting (#919)

🐛 Bug Fixes

Analyzer

  • Nullsafe operator chain fix: Track nullsafe-origin null to prevent false positives in chained access (#931)
  • Partial application symbol tracking: Track symbol references from closure creation ($foo->bar(...)) and partial function application ($foo->bar(?, ?)) to prevent false positive unused method errors
  • Namespace imports: Allow imports of symbol namespaces (#933)
  • Magic method parent:: calls: Treat parent:: calls as instance calls for magic methods (#916)
  • #[Override] for @method: Don't suggest #[Override] attribute for @method pseudo-methods (#914)
  • Null coalesce with never RHS: Suppress false positive for possibly-undefined array index in null coalesce with never RHS (#923)
  • String concatenation memory usage: Add threshold to stop exponential memory usage with complex string concatenations (#908, #909) by @Noojuno
  • Inherited docblock narrowing: Narrow inherited docblock return types based on child's native type

Prelude (Type Stubs)

  • DatePeriod type parameters: Specify IteratorAggregate type parameters for DatePeriod (#932)
  • strpos offset type: strpos supports negative offsets, replace int<0, max> with int (#890) by @Bleksak

Formatter

  • Property assignment alignment: Align property assignments with variable assignments (#926)

Linter

  • CLI flags in no-insecure-comparison: Ignore CLI flags like --password in the rule (#917)

CLI

  • NO_COLOR environment variable: Respect NO_COLOR env variable (#922)

Documentation

  • Slow docs page loading: Fix slow docs page loading (#915) by @shyim

🏗️ Internal

🙏 Thank You

Contributors

A huge thank you to everyone who contributed to this release:

Issue Reporters

Thank you to everyone who reported issues that were fixed in this release:

🚀 What's Next

More improvements and features coming soon! Stay tuned.

Full Changelog: 1.1.0...1.2.0

Don't miss a new mago release

NewReleases is sending notifications on new releases.