Skip to content

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

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

Open
wants to merge 6 commits into
base: 2.4-develop
Choose a base branch
from
18 changes: 14 additions & 4 deletions lib/internal/Magento/Framework/Console/CommandList.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
* Copyright 2015 Adobe
* All Rights Reserved.
*/

namespace Magento\Framework\Console;

/**
* 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,7 +37,7 @@ public function __construct(array $commands = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getCommands()
{
Expand Down