Mago 1.59.0 fixes analyzer narrowing across boolean guards, nullsafe checks, and elseif branches, improves generic and callable inference, and updates the analyzer extension protocol to MANA 2.2.
Note
Support Mago
Does your company use Mago? Please consider sponsoring its development so we can keep fixing bugs and shipping releases.
Sponsor Mago ❤️
🐛 Bug Fixes
Analyzer
- Namespace constants: preserves global constant fallback in namespaced declarations. (#2594, 0e6c1d8)
- Method assertions: keeps getter assertions from the right side of
||. (#2600, #2609, 777429f) - CLI argument guards: fixes
$argctyping and negatedcount()bounds. (#2607, #2608, be88d13) - Template defaults: applies declared defaults when constructing generic objects. (#2603, #2606, 2066b18)
- Stored booleans: keeps narrowing implied by boolean variables across
&&and||. (#2601, 8d739b3) - Nullsafe membership: narrows receivers after strict
in_array()checks against non-null values. (#2599, 56e4b49) - Collection intersections: honors narrower read types in intersected collection types. (#2612, 79c295f)
- Callable signatures: preserves parameter and return types through
Closure::fromCallable(). (#2611, #2614, 3ea5963) - PHPDoc generics: checks missing, excess, and out-of-bounds template arguments in docblocks. (#2616, 2ac5c5d)
- Boolean branches: preserves
trueandfalsetypes across short-circuit expressions. (#2593, 9890d23) - Dynamic instanceof: keeps valid operand types when a dynamic class check fails. (#2592, #2595, 65530ba)
- Strict equality: narrows both union-typed operands to their shared types. (#2559, 923c061)
- Elseif branches: preserves all reachable types and branch facts after conditional chains. (#2619, 0a098f4)
- Nullsafe comparisons: avoids false impossible-null reports when assigning comparison results. (#2591, b7273f4)
- URL components: allows empty user, password, query, and fragment strings from
parse_url(). (#2590, #2610, 16dd70b)
📖 Documentation
Extensions
- Protocol compatibility: documents MANA 2.2 constant fallback and worker upgrade requirements. (#2594, 0e6c1d8)
🏗️ Internal
CI
- Pull request limit: limits outside contributors to one open PR at a time, including drafts. (9b6979c)
Tooling
- Justfile cleanup: removes an unused variable. (3f212f3)
🧩 Extension Protocol
Analyzer
- MANA 2.2: adds namespace fallbacks to global constant references in the protocol and PHP SDK. (#2594, 0e6c1d8)
Update the PHP SDK to 1.59.0 when upgrading Mago. Custom analyzer workers must use MANA 2.2; MANA 2.1 workers are not compatible. The linter protocol is unchanged.
🙏 Thank You
Contributors
Thank you to everyone who contributed to this release:
- @alfredbez: #2559
- @hbenabdallah: #2595
- @pujitha24: #2610
- @shuvroroy: #2606, #2608, #2609, #2614
- @serdarucel for investigating #2591 in #2598.
Issue Reporters
Thank you to everyone who reported issues that shaped this release:
- @alfredbez: #2619
- @cweiske: #2611
- @douglasgreen: #2607
- @gsteel: #2593
- @MichaelOwenDyer: #2591, #2592, #2599, #2600, #2601
- @NoNoNo: #2594
- @norberttech: #2616
- @npo-mmenke: #2603, #2612
- @patka-123: #2590
Full Changelog: 1.58.2...1.59.0