Mago 1.0.0-beta.17
This release introduces two major new analyzer features—full support for argument unpacking and @var
support for constants—along with a host of other correctness fixes and quality-of-life improvements for the CLI and configuration.
🚀 Major Analyzer Features
Full Support for Unpacked Arguments (...
)
Mago's analyzer now has comprehensive support for argument unpacking (...
), closing a significant gap in its capabilities. The analyzer correctly validates the number of arguments and performs full type-checking on each element within an unpacked array, for both positional and named arguments. This significantly improves correctness for modern PHP code.
@var
Support for Constants
The analyzer now fully supports @var
docblocks on both const
and define()
declarations. This allows you to provide explicit types for constants with complex values (like function calls).
To encourage good practice, the analyzer also introduces a new non-documented-constant
warning. If a constant is defined with a complex value but lacks a @var
tag, the analyzer will issue a warning and suggest the inferred type, helping you make your code more robust and analyzable.
✨ Improvements & Fixes
-
Analyzer:
- Fixed a critical bug where unquoted string keys in PHPDoc array shapes (e.g.,
{dateTime: string}
) could be incorrectly resolved as class names, leading to false positives. (#413) - Correctly allows passing extra named arguments to variadic functions, aligning with PHP's runtime behavior. (#461)
- Corrected the signatures for several built-in PHP functions in the prelude for more accurate analysis. (#449)
- Fixed a critical bug where unquoted string keys in PHPDoc array shapes (e.g.,
-
Configuration & CLI:
- You can now specify a default
baseline
path in yourmago.toml
for both the[analyzer]
and[linter]
sections, removing the need to pass the--baseline
flag on every run. (#460) - The help text and descriptions for all CLI commands and their arguments have been significantly improved to be more detailed and user-friendly.
- You can now specify a default
-
Internal:
- The invocation analysis logic has been refactored for better clarity and maintainability.
Closed Issues
Full Changelog: 1.0.0-beta.16...1.0.0-beta.17