Skip to content

Commit

Permalink
Don't use magic number for default error code. Also fix up last wrong…
Browse files Browse the repository at this point in the history
… doc blocks.
  • Loading branch information
Mark Scherer committed Dec 28, 2015
1 parent 4d34772 commit 5055e0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/Console/ConsoleOptionParser.php
Expand Up @@ -169,7 +169,7 @@ public function __construct($command = null, $defaultOptions = true)
*
* @param string|null $command The command name this parser is for. The command name is used for generating help.
* @param bool $defaultOptions Whether you want the verbose and quiet options set.
* @return ConsoleOptionParser
* @return \Cake\Console\ConsoleOptionParser
*/
public static function create($command, $defaultOptions = true)
{
Expand Down Expand Up @@ -197,7 +197,7 @@ public static function create($command, $defaultOptions = true)
*
* @param array $spec The spec to build the OptionParser with.
* @param bool $defaultOptions Whether you want the verbose and quiet options set.
* @return ConsoleOptionParser
* @return \Cake\Console\ConsoleOptionParser
*/
public static function buildFromArray($spec, $defaultOptions = true)
{
Expand Down Expand Up @@ -371,7 +371,7 @@ public function addOption($name, array $options = [])
* Remove an option from the option parser.
*
* @param string $name The option name to remove.
* @return ConsoleOptionParser this
* @return \Cake\Console\ConsoleOptionParser this
*/
public function removeOption($name)
{
Expand Down
13 changes: 10 additions & 3 deletions src/Console/Shell.php
Expand Up @@ -40,6 +40,13 @@ class Shell
use MergeVariablesTrait;
use ModelAwareTrait;

/**
* Default error code
*
* @var int
*/
const CODE_ERROR = 1;

/**
* Output constant making verbose shells.
*
Expand Down Expand Up @@ -496,7 +503,7 @@ protected function _displayHelp($command)
*
* By overriding this method you can configure the ConsoleOptionParser before returning it.
*
* @return ConsoleOptionParser
* @return \Cake\Console\ConsoleOptionParser
* @link http://book.cakephp.org/3.0/en/console-and-shells.html#configuring-options-and-generating-help
*/
public function getOptionParser()
Expand Down Expand Up @@ -680,9 +687,9 @@ public function error($title, $message = null)
if (!empty($message)) {
$this->_io->err($message);
}
$this->_stop(1);
$this->_stop(self::CODE_ERROR);

return 1;
return self::CODE_ERROR;
}

/**
Expand Down

0 comments on commit 5055e0d

Please sign in to comment.