Skip to content

Mago 0.0.14

Compare
Choose a tag to compare
@github-actions github-actions released this 22 Dec 21:33
· 347 commits to main since this release
3143409

We are thrilled to unveil Mago v0.0.14, a groundbreaking update that takes Mago to the next level! This release introduces reflections, smarter linting, and critical bug fixes.

🚀 New Features

Reflections and Built-in PHP Type Awareness

  • Mago is now aware of all PHP built-in types, thanks to JetBrains/phpstorm-stubs.
  • Reflections enable Mago to analyze and understand your entire codebase, including built-in PHP types, user-defined code, and dependencies.

New Analysis Linter Plugin

  • Undefined Functions Rule: Detects and notifies you about calls to undefined functions.
  • Undefined Constants Rule: Identifies the usage of undefined constants.
  • These rules are just the beginning! Reflections pave the way for detecting runtime errors statically, with planned rules for inheritance and other advanced analysis.

Smarter Linter Suggestions

  • Mago’s linter is now smarter and more context-aware:
    • It will no longer suggest renaming parameters or adding types to parameters inherited from a class or interface, avoiding potential inheritance-breaking changes.

Improved Analysis with Composer

  • To get the best results, include your vendor directory in your configuration file (excluding composer files). Example:
[source]
paths = ["src"]
includes = ["vendor"]
excludes = ["*/vendor/composer/*"]

🐛 Bug Fixes

Lexer Fixes

  • Recognizes callable as a keyword.
  • Correctly parses heredoc when a line starts with the label text (e.g., PHPDOC in the example below).
$a = <<<PHP

PHPDOC <-- no longer mistakenly considered as the closing label

PHP;

Linter Fixes

  • The implicit nullable parameter rule now fixes code correctly, preventing runtime issues.

Formatter Fixes

  • Parentheses are preserved in cases like new ($foo->bar())() to avoid errors.

🌟 Community Contributions

A huge shoutout to @bendavies (Ben Davies) for reporting many of these issues in our Discord. Your feedback and effort make Mago better for everyone!


What's Changed

Full Changelog: 0.0.13...0.0.14