8000 [Console] Review Application docblocks by ogizanagi · Pull Request #20813 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Console] Review Application docblocks #20813

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

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
[Console] Review Application docblocks
  • Loading branch information
ogizanagi committed Dec 13, 2016
commit a80c5f73cdf1c455cb5910a674653b601728164f
77 changes: 53 additions & 24 deletions src/Symfony/Component/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class Application
private $defaultCommand;

/**
* Constructor.
*
* @param string $name The name of the application
* @param string $version The version of the application
*/
Expand Down Expand Up @@ -100,9 +102,6 @@ public function setDispatcher(EventDispatcherInterface $dispatcher)
* @param OutputInterface $output An Output instance
*
* @return int 0 if everything went fine, or an error code
*
* @throws \Exception When doRun threw an exception and catchExceptions is false
* @throws \Throwable When doRun threw a throwable
*/
public function run(InputInterface $input = null, OutputInterface $output = null)
{
Expand Down Expand Up @@ -195,14 +194,16 @@ public function doRun(InputInterface $input, OutputInterface $output)
/**
* Set a helper set to be used with the command.
*
* @param HelperSet $helperSet
* @param HelperSet $helperSet The helper set
*/
public function setHelperSet(HelperSet $helperSet)
{
$this->helperSet = $helperSet;
}

/**
* Get the helper set associated with the command.
*
* @return HelperSet The HelperSet instance associated with this command
*/
public function getHelperSet()
Expand All @@ -213,30 +214,36 @@ public function getHelperSet()
/**
* Set an input definition to be used with this application.
*
* @param InputDefinition $definition
* @param InputDefinition $definition The input definition
*/
public function setDefinition(InputDefinition $definition)
{
$this->definition = $definition;
}

/**
* @return InputDefinition The InputDefinition related to this Application
* Gets the InputDefinition related to this Application.
*
* @return InputDefinition The InputDefinition instance
*/
public function getDefinition()
{
return $this->definition;
}

/**
* @return string The help message
* Gets the help message.
*
* @return string A help message
*/
public function getHelp()
{
return $this->getLongVersion();
}

/**
* Sets whether to catch exceptions or not during commands execution.
*
* @param bool $boolean Whether to catch exceptions or not during commands execution
*/
public function setCatchExceptions($boolean)
Expand All @@ -245,6 +252,8 @@ public function setCatchExceptions($boolean)
}

/**
* Sets whether to automatically exit after a command execution or not.
*
* @param bool $boolean Whether to automatically exit after a command execution or not
*/
public function setAutoExit($boolean)
Expand All @@ -253,6 +262,8 @@ public function setAutoExit($boolean)
}

/**
* Gets the name of the application.
*
* @return string The application name
*/
public function getName()
Expand All @@ -263,14 +274,16 @@ public function getName()
/**
* Sets the application name.
*
* @param string $name
* @param string $name The application name
*/
public function setName($name)
{
$this->name = $name;
}

/**
* Gets the application version.
*
* @return string The application version
*/
public function getVersion()
Expand All @@ -279,6 +292,8 @@ public function getVersion()
}

/**
* Sets the application version.
*
* @param string $version The application version
*/
public function setVersion($version)
Expand All @@ -287,6 +302,8 @@ public function setVersion($version)
}

/**
* Returns the long version of the application.
*
* @return string The long application version
*/
public function getLongVersion()
Expand Down Expand Up @@ -319,7 +336,7 @@ public function register($name)
*
* If a Command is not enabled it will not be added.
*
* @param Command[] $commands
* @param Command[] $commands An array of commands
*/
public function addCommands(array $commands)
{
Expand All @@ -334,7 +351,7 @@ public function addCommands(array $commands)
* If a command with the same name already exists, it will be overridden.
* If the command is not enabled it will not be added.
*
* @param Command $command
* @param Command $command A Command object
*
* @return Command|null The registered command if enabled or null
*/
Expand Down Expand Up @@ -366,7 +383,7 @@ public function add(Command $command)
*
* @param string $name The command name or alias
*
* @return Command
* @return Command A Command object
*
* @throws \InvalidArgumentException When given command name does not exist
*/
Expand All @@ -391,6 +408,8 @@ public function get($name)
}

/**
* Returns true if the command exists, false otherwise.
*
* @param string $name The command name or alias
*
* @return bool true if the command exists, false otherwise
Expand Down Expand Up @@ -468,7 +487,7 @@ public function findNamespace($namespace)
*
* @param string $name A command name or a command alias
*
* @return Command
* @return Command A Command instance
*
* @throws \InvalidArgumentException When command name is incorrect or ambiguous
*/
Expand Down Expand Up @@ -525,7 +544,7 @@ public function find($name)
*
* @param string $namespace A namespace name
*
* @return Command[]
* @return Command[] An array of Command instances
*/
public function all($namespace = null)
{
Expand All @@ -544,9 +563,11 @@ public function all($namespace = null)
}

/**
* @param string[] $names An array of names
* Returns an array of possible abbreviations given a set of names.
*
* @param array $names An array of names
*
* @return array An array of possible abbreviations given a set of names.
* @return array An array of abbreviations
*/
public static function getAbbreviations($names)
{
Expand Down Expand Up @@ -808,8 +829,6 @@ protected function configureIO(InputInterface $input, OutputInterface 8000 $output)
* @param OutputInterface $output An Output instance
*
* @return int 0 if everything went fine, or an error code
*
* @throws \Throwable|\Exception when the command being run threw an throwable
*/
protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
{
Expand Down Expand Up @@ -859,17 +878,21 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
}

/**
* @param InputInterface $input
* Gets the name of the command based on input.
*
* @param InputInterface $input The input interface
*
* @return string The command name based on input
* @return string The command name
*/
protected function getCommandName(InputInterface $input)
{
return $input->getFirstArgument();
}

/**
* @return InputDefinition The default input definition
* Gets the default input definition.
*
* @return InputDefinition An InputDefinition instance
*/
protected function getDefaultInputDefinition()
{
Expand All @@ -887,15 +910,19 @@ protected function getDefaultInputDefinition()
}

/**
* @return Command[] The default commands that should always be available
* Gets the default commands that should always be available.
*
* @return Command[] An array of default Command instances
*/
protected function getDefaultCommands()
{
retu 67ED rn array(new HelpCommand(), new ListCommand());
}

/**
* @return HelperSet The default helper set with the helpers that should always be available
* Gets the default helper set with the helpers that should always be available.
*
* @return HelperSet A HelperSet instance
*/
protected function getDefaultHelperSet()
{
Expand Down Expand Up @@ -1042,7 +1069,7 @@ private function findAlternatives($name, $collection)
/**
* Sets the default Command name.
*
* @param string $commandName
* @param string $commandName The Command name
*/
public function setDefaultCommand($commandName)
{
Expand Down Expand Up @@ -1099,9 +1126,11 @@ private function splitStringByWidth($string, $width)
}

/**
* Returns all namespaces of the command name.
*
* @param string $name The full name of the command
*
* @return string[] The namespaces of the command name
* @return string[] The namespaces of the command
*/
private function extractAllNamespaces($name)
{
< 40B7 a href="#diff-8f1fd83284712ab08cb5d391da70ea0e78719ef08db852596997a4085848a026" id="expand-down-link--diff-8f1fd83284712ab08cb5d391da70ea0e78719ef08db852596997a4085848a026" class="js-expand directional-expander single-expander" aria-label="Expand Down" data-url="/symfony/symfony/blob_excerpt/a9400127e6da48b8856421e91e63e088d9b343c9?context=pull_request&diff=unified&direction=down&in_wiki_context&last_left=1107&last_right=1136&left=1152&left_hunk_size&mode=100644&path=src%2FSymfony%2FComponent%2FConsole%2FApplication.php&pull_request_id=96911746&right=1152&right_hunk_size" data-left-range="1108-1151" data-right-range="1137-1151"> Expand Down
0