Mago 1.45.0
This release teaches the analyzer to build keyed array shapes from get_object_vars(), adds @param-closure-this support and an auto-fix for overly-wide return types, introduces a linter rule preferring DateTimeImmutable::createFromTimestamp(), fixes a batch of analyzer false positives, and makes empty reports valid SARIF/JSON documents for CI.
✨ Features
Analyzer
get_object_vars()shapes: returns keyed array shapes built from the object's visible properties. (#2110, a729ce1)@param-closure-this: supports the docblock tag for typing a closure parameter's$this. (#2131, 6000d41)- Overly-wide return types: adds an auto-fix that narrows the declared return type. (#2068, #2120, 9e4d186)
Linter
prefer-datetimeimmutable-create-from-timestamp: suggests the factory overnew DateTimeImmutable('@...'). (#2118, 38b6152)
🐛 Bug Fixes
Analyzer
- Readonly promotion: detects reinitialization of promoted readonly properties in parent constructors. (#2127, 490452e)
- Escaping breaks: preserves breaks that escape nested loops in reachability analysis. (#2124, 635eeab)
- Guarded members: tracks
method_existsguards on descendant members. (#2125, d1b6e9c) - PSL analysis: eliminates false positives when analyzing PSL-based code. (6527f24)
array_mapshapes: preserves array shapes for untyped closures. (#2122, 816578a)- Catch variables: refines definedness for precise conditions in try/catch. (#2119, aa469b9)
- Hooked properties: tracks property-hook writes against the read type. (#2112, bd95ea5)
- Split property types: supports distinct
@property-readand@property-writetypes. (#2079, #2108, b54a881) @propertyvisibility: resolves tags according to call-site visibility. (#2106, a4b077d)
Codex
- Enum case literals: infers literal values from class constants, tightening integer conditions. (#2111, 237465e)
Prelude
Reporting
- Empty reports: emits valid SARIF, JSON, GitLab, and Checkstyle documents when there are no issues. (#2128, 003ff32)
Playground
🙏 Thank You
Contributors
A huge thank you to everyone who contributed code to this release:
Issue Reporters
Thank you to everyone who reported issues that shaped this release:
- @UweOhse: #2068
- @mytskine: #2079
- @Norbytus: #2110
- @BafS: #2111, #2119, #2124, #2125
- @mathroc: #2116, #2118
- @dotdash: #2121
- @PellegrinoDurante: #2126
- @maximal: #2127
- @gsteel: #2128
Full Changelog: 1.44.0...1.45.0