Mago 1.0.0-rc.12
This release continues our focus on reducing false positives, improving generic type handling, and enhancing PHP 8.4+ property hooks support.
New Features
Analyzer
- Uninitialized Property Detection: Added detection for uninitialized properties and missing constructors, helping catch potential runtime errors before they occur.
Formatter
- Staged Formatting Support: Added
fmt --stagedcommand for formatting only staged files, along with a pre-commit hooks guide for seamless CI integration.
Bug Fixes
Analyzer
- Generic Parameter Literal Equality: Fixed false "impossible condition" warnings when comparing generic parameters to literal values (
=== '',=== 0,=== 1.5,=== true,=== false) after type narrowing in OR conditions. - Property Hook Inheritance: Fixed false positive for
unimplemented-abstract-property-hookwhen a concrete class inherits the hook implementation from a parent class. is_callable()Narrowing: Added support foris_callable()type narrowing on array callables withclass-stringelements (e.g.,array{class-string<Foo>, 'method'}).isset()on Open Array Shapes: Fixed false positives when usingisset()checks on open array shapes with mixed values.- Dynamic Property Access on
stdClass: Allowed dynamic property access onstdClasswithout triggering errors. - Method Override Compatibility: Added verification of method compatibility when overriding non-abstract methods from parent classes.
- Generic Parameter Constraint Binding: Fixed issue where generic parameters were incorrectly bound when constraints were not satisfied.
Codex
- Property Hook Types: Fixed population of property hook parameter and return types for proper type checking.
- Deterministic Output: Ensured consistent ordering of parent classes and interfaces for deterministic analysis results.
Docblock
@methodTag Parsing: Fixed parsing of@methodtags with leading whitespace.
Formatter
- Heredoc/Nowdoc Comment Preservation: Fixed critical bug where comments before heredoc/nowdoc (e.g.,
/** @lang SQL */) were incorrectly moved after the opening identifier, resulting in invalid code. - Consistent Defaults: Made
empty_line_after_opening_tagdefault behavior consistent across configurations.
New Contributors
- @magic-akari made their first contribution in #713
Full Changelog: 1.0.0-rc.11...1.0.0-rc.12