Releases: carthage-software/mago
Mago 0.0.13
Enhancements
-
Internal Refactoring
- Various internal improvements to streamline performance and maintainability.
-
New Command:
mago self-update
- Easily update Mago to the latest version or check for updates without manual intervention.
Chores
-
Crates Removed
mago_cli
andmago_services
are no longer available.
-
Build Process Fixes
- Resolved build issues across multiple targets, ensuring broader compatibility.
New Feature: One-Line Installation
Quickly install or update Mago with a simple script for macOS or Linux.
Installation Command
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash
# or
wget -qO- https://carthage.software/mago.sh | bash
Full Changelog: 0.0.12...0.0.13
Mago 0.0.12
Enhancements
- Linter Rules:
-
no-unsafe-finally
- What it does: Prevents the use of
return
,throw
,break
, andcontinue
withinfinally
blocks intry
statements. - Why it matters: Ensures code predictability and avoids unintended control flow behavior when
finally
executes.
- What it does: Prevents the use of
-
no-multi-assignments
- What it does: Disallows chained assignments like
$a = $b = $c
. - Why it matters: Improves code clarity and reduces the risk of bugs caused by unintended assignments.
- What it does: Disallows chained assignments like
-
Chores
- Refactor
ast-utils
crate:- Details: Comprehensive refactor of the
ast-utils
crate. - Impact: This change introduces breaking changes (BC breaks), so ensure to review and adapt your projects accordingly when updating.
- Details: Comprehensive refactor of the
Expanded Build Target Support
We now support a broader range of targets in our build process, ensuring compatibility across diverse systems. Below is the updated list of supported targets:
Windows
- MinGW
x86_64-pc-windows-gnu
- MSVC
-i686-pc-windows-msvc
(tested)
-x86_64-pc-windows-msvc
(tested)
macOS
aarch64-apple-darwin
(tested)x86_64-apple-darwin
(tested)
FreeBSD
i686-unknown-freebsd
x86_64-unknown-freebsd
Linux
aarch64-unknown-linux-gnu
(tested)arm-unknown-linux-gnueabi
arm-unknown-linux-gnueabihf
armv7-unknown-linux-gnueabihf
arm-unknown-linux-musleabi
arm-unknown-linux-musleabihf
armv7-unknown-linux-musleabihf
i686-unknown-linux-gnu
(tested)i686-unknown-linux-musl
(tested)powerpc-unknown-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
s390x-unknown-linux-gnu
x86_64-unknown-linux-gnu
(tested)x86_64-unknown-linux-musl
(tested)
Full Changelog: 0.0.11...0.0.12
Mago 0.0.11
Fixes
- Lexer: Improved error handling for unterminated multiline comments.
- Formatter: Fixed formatting issues with literal strings.
Full Changelog: 0.0.10...0.0.11
Mago 0.0.10
Mago 0.0.10 Release Notes
Enhancements
- Reporting:
- Linter:
Fixes
- Reflector: Improved handling of constant items, especially in PHP 8.5 and above.
- Lexer: Fixed tokenization of empty multiline comments.
Chore
Full Changelog: 0.0.9...0.0.10
Mago 0.0.9
New Features
-
Linter Command:
- Introduced
--reporting-target
and--reporting-format
flags to themago lint
command, providing greater flexibility in how linting issues are reported.
--reporting-target
:Allows specifying the output target for issue reports.
- Default:
stdout
- Options:
stdout
: Outputs to standard output.stderr
: Outputs to standard error.
--reporting-format
:Allows selecting the format for issue reports.
- Default:
rich
- Options:
rich
: Detailed output for terminal display.medium
: Compact, terminal-friendly format.short
: Minimal output, useful for quick overviews.github
: Tailored for GitHub Actions annotations.json
: Structured JSON output for machine-readable reports.
- Introduced
Full Changelog: 0.0.8...0.0.9
Mago 0.0.8
Enhancements
-
Linter:
-
Introduce Laravel Plugin: Adds a new Laravel-specific plugin with an initial rule detecting
Request::all()
usage and suggestingRequest::only(...)
instead. Enable it with:[linter] plugins = ["laravel"]
Future plans include adding more Laravel-specific rules.
-
Add Combine Consecutive Issets Rule: Transforms
isset($a) && isset($b)
into the more conciseisset($a, $b)
. -
Introduce Migration Plugin: Adds two migration rules:
- Convert
strpos($a, $b) == 0
tostr_starts_with($a, $b)
- Convert
strpos($a, $b) != false
tostr_contains($a, $b)
More PHP migration rules are planned for future releases.
- Convert
-
Add Explicit Octal Notation Rule: Part of the migration plugin, converts old-style octal notation (e.g.,
012
) to the more explicit0o12
for improved readability. -
Add Readonly Class Promotion Rule: Transforms classes with only readonly properties into a readonly class, removing individual readonly modifiers for cleaner code.
-
Introduce Deprecation Plugin: Detects PHP deprecations with two initial rules:
- Convert implicitly nullable params
string $a = null
to explicitly nullable?string $a = null
(deprecated in PHP 8.4) - Identify and suggest renaming class-like nodes named
_
(deprecated in PHP 8.4)
- Convert implicitly nullable params
-
Add PHP 8.0 and 8.2 Deprecation Rules:
- Detect optional parameters before required ones (deprecated in PHP 8.0)
- Identify return by reference from void functions/methods/closures (deprecated in PHP 8.2)
Fixes
- Formatter:
- Preserve Single Inline Argument Formatting: Fixes an issue where a single argument to a function call would incorrectly break the parent nodes' formatting.
Full Changelog: 0.0.7...0.0.8
Mago 0.0.7
Enhancements
- Linter:
- Added PHPUnit plugin: Introduces basic rules for improving PHPUnit usage. Enable it with:
[linter] plugins = ["phpunit"]
- Added PHPUnit plugin: Introduces basic rules for improving PHPUnit usage. Enable it with:
Fixes
-
Formatter:
- Wrap method call chain base in parentheses when needed: Fixes an issue where parentheses were omitted incorrectly in cases like
($foo ?? $bar)->bar()->baz()->qux()->quxx()
, resulting in$foo ?? $bar->bar()->baz()->qux()->quxx()
Reported in #20 by @bendavies. - Default to next line in method chains: Ensures that the first method call in a chain starts on the next line, following PER CS 2.0 standards.
- Add missing parentheses around assignment LHS of array access: Fixes an issue where
$a ?? $b[$foo]
was misinterpreted due to missing parentheses in($a ?? $b)[$foo]
.
Reported in #18 by @bendavies. - Remove leading comma in argument lists: Fixes a bug where arguments like
foo($expr)
were incorrectly formatted asfoo(, $expr)
.
Reported in #19 by @bendavies.
- Wrap method call chain base in parentheses when needed: Fixes an issue where parentheses were omitted incorrectly in cases like
-
Linter:
- Fix the fix plan for
use-while-instead-of-for
: Resolves an issue wherefor (;;)
was incorrectly replaced withfor (; )
instead ofwhile (true)
.
Reported in #21 by @bendavies.
- Fix the fix plan for
Special thanks to @bendavies for testing and reporting several issues!
Full Changelog: 0.0.6...0.0.7
Mago 0.0.6
Enhancements
-
Linter:
- Added
redundant-continue-statement
rule: Detects redundantcontinue
statements in a loop - Added
no-empty-loop
rule: Detects and reports empty loops to improve code quality. - Added
missing-assert-description
rule: Ensuresassert()
statements include descriptions for better debugging context. - Added
loop-does-not-iterate
rule: Highlights loops that do not iterate due to immediate termination.
- Added
-
Miscellaneous:
Fixes
- Linter:
- Formatter:
Full Changelog: 0.0.5...0.0.6
Mago 0.0.5
Enhancements
-
Formatter:
- Implemented
--dry-run
for themago fmt
command - Removed timestamps and target information from logs to declutter output. Note: In debug mode, the target information is still displayed.
- Implemented
-
Linter Fix Command:
- Added messages to inform users when fixes are skipped due to requiring
--unsafe
or--potentially-unsafe
flags. Previously, these fixes were skipped without any user feedback. - Implemented
--dry-run
for themago fix
command. This allows users to preview linting fixes without making any changes to their files.
- Added messages to inform users when fixes are skipped due to requiring
What's Next
We continue to work diligently towards achieving a stable 1.0.0
release. Future updates will include more robust features, enhanced performance, and further refinements based on user feedback.
Feel free to reach out with any feedback or issues you encounter. Your input helps us make Mago better for everyone!
Full Changelog: 0.0.4...0.0.5
Mago 0.0.4
Fixes
Overview
In this release, we've addressed a critical bug in the formatter that affected the parsing of closure creations in PHP code. Specifically, the formatter was removing parentheses around the left-hand side (lhs) of a closure creation node when it was necessary, leading to parse errors.
Bug Details:
Before the fix:
$a = (function(): void {})(...);
After the formatter incorrectly processed it:
$a = function(): void {}(...);
This removal of parentheses caused the PHP parser to throw an error, disrupting the intended functionality.
What’s Fixed:
- The formatter now correctly preserves the parentheses around the lhs of closure creation nodes. This ensures that the following code is formatted correctly and parses without errors:
$a = (function(): void {})(...);
What's Next
We continue working diligently towards achieving a stable 1.0.0 release. Stay tuned for more updates, features, and fixes in upcoming versions!
We have skipped the release version
0.0.3
due to a minor issue.