Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved readability and reduced code #54447

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AmirHkrg
Copy link

@AmirHkrg AmirHkrg commented Feb 3, 2025

Enhance Command Registration with registerCommandWithDependencies Method

Overview

This PR refactors the command registration process by introducing the registerCommandWithDependencies method. The goal is to improve readability, reduce boilerplate code, and make dependency injection for commands more maintainable.

Changes

  • Extracted commands that require dependencies into $registerCommandsWithDependencies.
  • Added registerCommandWithDependencies to handle automatic dependency resolution.
  • Kept other commands in $commands and $devCommands for clarity.
  • Improved maintainability by reducing repetitive registerXXXCommand methods.

Benefits

  • Less boilerplate code – Fewer explicit registration methods.
  • Better maintainability – Easier to add new commands by simply updating $registerCommandsWithDependencies.
  • Cleaner structure – Command dependencies are now explicitly defined in a single place.

Testing

  • Verified that all commands register correctly.
  • Ensured no breaking changes in the command execution flow.

Would love to get your feedback!

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.

1 participant