Skip to content

Add Mago as task#1216

Open
johnatas-x wants to merge 3 commits intophpro:v2.xfrom
johnatas-x:mago-task
Open

Add Mago as task#1216
johnatas-x wants to merge 3 commits intophpro:v2.xfrom
johnatas-x:mago-task

Conversation

@johnatas-x
Copy link
Copy Markdown

Q A
Branch mago-task
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Documented? yes
Fixed tickets #1193

This PR adds a Mago task

Mago is a recent tool that includes a formatter (like phpcs), a linter (like phpmd), and a static analyzer (like phpstan).
It is known for its performance and is starting to be increasingly adopted (for example, in Drupal).
Its integration into GrumPHP seems valuable.

New Task Checklist:

  • Are the dependencies added to the composer.json suggestions?
  • Is the doc/tasks.md file updated?
  • Are the task parameters documented?
  • Is the task registered in the tasks.yml file?
  • Does the task contains phpunit tests?
  • Is the configuration having logical allowed types?
  • Does the task run in the correct context?
  • Is the run() method readable?
  • Is the run() method using the configuration correctly?
  • Are all CI services returning green?

@johnatas-x johnatas-x mentioned this pull request Apr 30, 2026
Copy link
Copy Markdown
Contributor

@veewee veewee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.
I think this task in current state is not in line with other tasks. I've added some remarks inline in the code. Feel free to stat a discussion.

Comment thread src/Task/Mago.php Outdated
Comment thread src/Task/Mago.php Outdated
Comment thread src/Task/Mago.php Outdated
@johnatas-x
Copy link
Copy Markdown
Author

Hey @veewee,

Thanks for taking the time to review the PR and share your feedback.
Your comments align with the questions I raised in the related issue.

To be fully transparent, after opening the PR I had already started reworking it to introduce 4 commands. I’ll update the PR this week with those changes; it should end up closer to how the SecurityChecker tasks are structured, which should resolve the three threads.

If you have any additional feedback, feel free to share it so I can address everything at once.

@johnatas-x
Copy link
Copy Markdown
Author

Hey,

I just pushed a refactor splitting the mago task into 4 distinct subtasks: mago_lint, mago_analyze, mago_format, and mago_guard. Each task now follows the same structure as other tasks, with its own configurable options, dedicated documentation, and unit tests.

The mago task itself now serves two purposes: it acts as a redirect, pointing users to the 4 subtasks when invoked directly, and as a base class holding the shared logic to avoid code duplication across the subtasks.

Happy to hear any feedback — whether on the option coverage, naming, documentation, or anything else that could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants