github carthage-software/mago 1.0.0-beta.11
Mago 1.0.0-beta.11

latest release: 1.0.0-beta.12
one day ago

Mago 1.0.0-beta.11

This release introduces support for new PHP features, adds stubs for the php-decimal extension, and fixes several bugs in type inference and assertion logic.

🚀 Features

  • Flexible Linter Configuration: You can now configure linter rule levels in your mago.toml file using common lowercase aliases. For example, instead of just "Error", you can now use "error", "err", or "deny". This makes configuration more intuitive and consistent with other tools. (#381 by @azjezz)
  • PHP 8.5 #[Deprecated] on Traits: Mago now recognizes the #[Deprecated] attribute on traits, a new feature in PHP 8.5. (#386 by @DanielEScherzer)
  • php-decimal Extension Support: Stubs for the php-decimal extension have been added to the prelude, improving analysis accuracy for projects that use this extension. (#397 by @Bleksak)

🐛 Bug Fixes

  • Array Key Existence: The analyzer's understanding of array key checks has been significantly improved.
    • Functions like array_key_exists(), key_exists(), and Psl\Iter\contains_key() now correctly inform the type system that a key exists after being checked. (#392 by @Bleksak)
    • Fixed a bug where checking for the existence of one array key (e.g., isset($a['foo'])) would incorrectly imply that a different key also exists. (#393, #394 by @Bleksak)
  • unset() on Lists: Fixed a type inference bug where using unset() on an element of a list<T> would incorrectly preserve the list type. The type is now correctly widened to array<int, T>, reflecting that the keys may no longer be sequential. (#396 by @azjezz)
  • Exact Count Assertions: Conditions that check for an exact item count (e.g., count($array) === 1) now correctly narrow the array's type to be non-empty. (#388 by @azjezz)
  • Refined end() Stub: The return type annotation for the built-in end() function has been made more precise, correctly distinguishing between the return types for empty and non-empty arrays. (#387 by @Bleksak)
  • sizeof() Alias: The function stub for sizeof() now exactly mirrors count(), as it's a direct alias, ensuring consistent type analysis. (#389 by @Bleksak)

🔧 Internal Changes

  • Test Suite Improvements: The analyzer's test suite now uses a shared mago-prelude for built-in PHP stubs. This reduces boilerplate in test files and ensures that tests run against the same definitions used in production analysis. (by @azjezz)

🤝 New Contributors

Full Changelog: 1.0.0-beta.10...1.0.0-beta.11

Don't miss a new mago release

NewReleases is sending notifications on new releases.