Mago 1.57.0 adds opt-in BcMath/GMP arithmetic, applies PHPDoc flags from type patches, fixes analyzer and formatter bugs, and speeds up work across the toolchain.
Note
Support Mago
Does your company use Mago? Please consider sponsoring its development so we can keep fixing bugs and shipping releases.
Sponsor Mago ❤️
✨ Features
Analyzer
- Number operators: adds opt-in arithmetic for
BcMath\NumberandGMPviaallow-operator-overloading. (#2486, #2487, 0fff359)
🐛 Bug Fixes
Analyzer
- Native type contracts: keeps native types and nullability when PHPDoc conflicts. (#2494, 2dc705f)
- Inline @var tags: no longer treats unassigned local variables as defined. (#2496, 56f2ad9)
- Malformed PHPDoc: reports malformed types and unresolved variable links. (#2493, c1cdff1)
- Conditional variables: reports possibly undefined variables after switch and in finally. (#2497, e378e5d)
- Iterator types: keeps current() and key() types without explicit generics. (#2476, 467b29d)
- Array unions: preserves left-hand values and optional keys with array-key key types. (#2485, #2488, 782b0b5)
- Empty checks: handles unset variables and falsy values correctly. (#2484, 8dc47c5)
- Dynamic properties: honors AllowDynamicProperties on classes and their ancestors. (#2483, 6bccb58)
- Deprecated members: reports access to deprecated properties and class constants. (#2478, 90fa5e5)
- Deprecated scopes: skips deprecation warnings inside already deprecated code. (#2492, d412c32)
- Boolean assignments: avoids false narrowing when loops update boolean flags. (#2499, 64ad7d6)
- Iterable assertions: narrows traversables without false impossible-condition reports. (#2508, ac54e6c)
Codex
- Patch flags: applies supported PHPDoc flags and their negations from type patches. (#2477, #2495, 29f3416)
Formatter
- Stable layouts: keeps concatenations, arrow functions, and assignments stable across passes. (#2491, 9f4804d)
- Parenthesized comparisons: keeps comparison layouts stable when operands use parentheses. (#2480, f2fdf5f)
Prelude
📖 Documentation
Configuration
- Operator settings: documents opt-in number operators in English, French, and Chinese. (#2487, 0fff359)
- Patch flags: documents supported PHPDoc patch flags in English, French, and Chinese. (#2495, 29f3416)
🏗️ Internal
Analyzer
- Named arguments: speeds up argument matching and default type inference. (#2498, 2f7475f)
- Member checks: cuts reference scans and allocations when checking unused members. (cc19617)
- Default arguments: skips needless type expansion for omitted non-generic defaults. (#2506, #2507, 6590a7b)
Codex
- Reference lookups: speeds up reference queries and merges. (23ebbf2)
Formatter
- Formatting work: cuts allocations and layout work. (a2e8ae5)
Guard
- Dependency scans: skips unused dependency files and cuts allocations. (dae8785)
🧩 Extension Protocol
No protocol changes in this release.
🙏 Thank You
Contributors
Thank you to everyone who contributed to this release:
- @alfredbez: #2476, #2492, #2493, #2494, #2496, #2497, #2511
- @AnnaDamm: #2495, #2507
- @matthewnessworthy: #2480
- @Mir-Zairan: #2487
- @ynaamane: #2488
Issue Reporters
Thank you to everyone who reported issues that shaped this release:
- @amateescu: #2478, #2508
- @AnnaDamm: #2477, #2498, #2506
- @atournayre: #2491
- @jfilter: #2483, #2484, #2485
- @MichaelOwenDyer: #2499
- @Mir-Zairan: #2486
Full Changelog: 1.56.3...1.57.0