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-issetrule: New rule to prevent usage of theissetconstruct (#924) by @djschilling- Redundant import detection: Detect redundant same-namespace and root-namespace imports in
no-redundant-userule (#921) - Auto-fixers for
lowercase-type-hintandlowercase-keyword: New fixers for these linter rules (#911) by @dotdash
Configuration
- Distribution config files: Add support for loading
mago.dist.tomlandmago.dist.jsonfiles (#903) by @Bleksak
Formatter
- Inline abstract property hooks: New
inline-abstract-property-hookssetting 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: Treatparent::calls as instance calls for magic methods (#916) #[Override]for@method: Don't suggest#[Override]attribute for@methodpseudo-methods (#914)- Null coalesce with
neverRHS: Suppress false positive for possibly-undefined array index in null coalesce withneverRHS (#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)
DatePeriodtype parameters: SpecifyIteratorAggregatetype parameters forDatePeriod(#932)strposoffset type:strpossupports negative offsets, replaceint<0, max>withint(#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--passwordin the rule (#917)
CLI
NO_COLORenvironment variable: RespectNO_COLORenv variable (#922)
Documentation
🏗️ Internal
- Update Nix flake to Rust 1.91.1 (#927) by @Zuruuh
- Simplify
FormatterPresetconfig deserialization (#879) by @magic-akari
🙏 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:
- @bendavies — #891
- @BenMorel — #919
- @Bleksak — #933, #932, #930, #929
- @Dima-369 — #932
- @djschilling — #836
- @dotdash — #931, #923
- @guvra — #867
- @lemmon — #921, #917
- @llaville — #922
- @Noojuno — #909
- @oleg-st — #889
- @ulrichsg — #916, #914
- @Valentin-Gaudin — #926
🚀 What's Next
More improvements and features coming soon! Stay tuned.
Full Changelog: 1.1.0...1.2.0