github carthage-software/mago 1.51.0
Mago 1.51.0

3 hours ago

Mago 1.51.0 adds Swoole stubs and improves type analysis, with fixes for static locals, loop types, boolean guards, lint suggestions, and formatting.

Note

Support Mago

Does your company use Mago? Please consider sponsoring its development. We need funding to keep improving Mago, fixing bugs, and shipping releases.

Sponsor Mago ❤️

✨ Features

Prelude

  • Swoole stubs: adds types for Swoole classes, functions, and constants. (#2298, 25b7c5f)

🐛 Bug Fixes

Analyzer

  • Static locals: tracks values across calls, including array keys added after initialization. (#2403, 452721b)
  • Invokable results: checks discarded __invoke results marked #[NoDiscard] or @must-use. (#2400, f01b94e)
  • Loop replacements: keeps new element types when a loop replaces every array value. (#2366, #2386, 2e560fa)
  • Unchanged arrays: preserves shapes and tuples after loops that leave their values unchanged. (#2409, 9608b8c)
  • Finally assignments: keeps types and definedness from assignments in finally blocks. (#2410, 71764f0)
  • Boolean guards: retains narrowing when a flag starts outside an if and changes in one branch. (#2411, 0d0224d)

Codex

  • String intersections: combines string refinements, including those in conditional types. (#2401, #2402, 4808b0a)

Linter

  • Self return types: skips intersection types to avoid fixes that cause PHP fatal errors. (#2405, 185644f)
  • Destructuring: keeps short arrays in assignment targets and nested list(). (#2407, #2408, a11d5e3, 5d804d7)
  • Drupal hook names: leaves hook_* names in *.api.php unchanged with Drupal integration. (#2390, #2391, 335d8a7)
  • WordPress output: checks short echo tags and recognizes more WordPress escaping functions. (#2397, 245c4a2)

Formatter

  • Closing tags: keeps ?> after method chains with a semicolon on its own line. (#2393, 17cc593)
  • Class constant arguments: wraps long calls whose sole argument is a class constant. (#2183, #2406, 22e0128)

Configuration

  • Shared configuration: replaces inherited extension commands and adds extends to the schema. (#2354, 8556e0e)

Prelude

  • str_increment: marks its return type as non-empty-string. (452721b)

Syntax

  • Braced interpolation: avoids repeated scans of nested string interpolation in the lexer. (de4c9b8)

📖 Documentation

Reference

  • Rule option types: shows nullable numeric options as number or null, using the schema. (#2398, 7ceff94)
  • Syntax tree names: uses CST consistently in docs and code comments. (#2327, 56b8844)

🧩 Extension Protocol

No protocol changes in this release.

🙏 Thank You

Contributors

A huge thank you to everyone who contributed to this release:

Issue Reporters

Thank you to everyone who reported issues that shaped this release:

Full Changelog: 1.50.0...1.51.0

Don't miss a new mago release

NewReleases is sending notifications on new releases.