Mago 1.0.0-beta.26
This release is a major step forward in the analyzer's correctness and reliability. It's packed with bug fixes that address a wide range of issues, especially for advanced object-oriented features like traits, generics, and intersection types.
🚀 Major Analyzer Correctness Fixes
This release significantly improves the accuracy of the type analyzer by resolving several fundamental bugs:
-
Callable Type Detection (#508): The analyzer's ability to determine if a type is
callable
has been completely overhauled. It now correctly handles inheritance for__invoke
, methods in array callables[$obj, 'method']
, intersection types, and generics. -
Trait Support Overhaul (#514, #9110b3f): The tool's understanding of traits is now much more robust. It correctly resolves method aliases (
use Trait { method as newName; }
), respects visibility overrides, and correctly resolvesself
in a trait method's return type to the consuming class. -
static
Return Type Resolution (#414): Fixed a critical bug where astatic
return type would be incorrectly resolved to the calling class scope instead of the class the method was called on, eliminating a class of false positiveInvalidReturnStatement
errors. -
Template Inference Fallback (#513): Un-inferred generic template parameters now correctly fall back to their upper bound (usually
mixed
) instead ofnever
. This fixes a major source of false positives for functions likecurrent()
when used withmixed
input. -
Boolean Comparison Assertions (#510): The analyzer now correctly creates type assertions from identity comparisons with
true
andfalse
(e.g.,if (true === ($a !== null && $b !== null))
). This makes type narrowing inif
andmatch
statements significantly more powerful.
🛠️ Other Fixes & Improvements
- Type System: An arbitrary limit on the number of literal strings and floats that could be combined into a union type has been removed, improving type accuracy for large arrays. (#493)
- Install Script: The
install.sh
script has been made more robust and can now correctly parse the latest release version even if the API response includes HTTP headers. (#516)
❤️ Community, Sponsorship, and the Future of PHP Tooling
We're incredibly honored to be featured in the latest JetBrains blog post, Moving PHP Open Source Forward.
Following this, we're thrilled to officially welcome @JetBrainsOfficial as a major sponsor! Their generous support is a huge vote of confidence in the project's vision and will be instrumental in helping us reach a stable 1.0 release.
We also want to give a warm welcome to our other new sponsors, @JacerOmri and @yigitcukuren!
And, as always, our heartfelt gratitude goes to our long-time supporters who continue to make this project sustainable:
Finally, thank you to @mathe42 for their code contribution in this release! (#497)
Your sponsorship helps dedicate more time to bug fixes, new features, and community support. If you or your company find this tool valuable, please consider sponsoring the project on GitHub. Thank you! 🙏
Closed Issues
Full Changelog: 1.0.0-beta.25...1.0.0-beta.26