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

Include Constructor to be a part of CommandListInterface API, extend inline documentation #37901

Open
wants to merge 3 commits into
base: 2.4-develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions lib/internal/Magento/Framework/Console/CommandList.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

/**
* Class CommandList has a list of commands, which can be extended via DI configuration.
* @api
*/
class CommandList implements CommandListInterface
{
Expand All @@ -17,7 +18,16 @@ class CommandList implements CommandListInterface
protected $commands;

/**
* Constructor
* CommandList constructor is being used for injecting new Commands
*
* Registration of new Commands can be done using `di.xml`:
* <type name="Magento\Framework\Console\CommandList">
* <arguments>
* <argument name="commands" xsi:type="array">
* <item name="your-command-name" xsi:type="object">Vendor\Module\Console\Command\YourCommand</item>
* </argument>
* </arguments>
* </type>
*
* @param array $commands
*/
Expand All @@ -27,9 +37,9 @@ public function __construct(array $commands = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCommands()
public function getCommands(): array
{
return $this->commands;
}
Expand Down