mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-19 06:18:07 +01:00
add Shell with ERROR and SUCCESS code
This commit is contained in:
parent
db0fef557d
commit
336ee32f92
@ -5,6 +5,7 @@ namespace Rector\Console\Command;
|
||||
use Nette\Loaders\RobotLoader;
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Console\ConsoleStyle;
|
||||
use Rector\Console\Shell;
|
||||
use Rector\ConsoleDiffer\MarkdownDifferAndFormatter;
|
||||
use Rector\Contract\Rector\RectorInterface;
|
||||
use Rector\Exception\ShouldNotHappenException;
|
||||
@ -65,8 +66,7 @@ final class GenerateRectorOverviewCommand extends Command
|
||||
$rectorsByGroup = $this->groupRectors($this->getGeneralRectors());
|
||||
$this->printRectorsByGroup($rectorsByGroup);
|
||||
|
||||
// success
|
||||
return 0;
|
||||
return Shell::CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,6 +4,7 @@ namespace Rector\Console\Command;
|
||||
|
||||
use Nette\Utils\Strings;
|
||||
use Rector\Console\ConsoleStyle;
|
||||
use Rector\Console\Shell;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
@ -43,7 +44,7 @@ final class LevelsCommand extends Command
|
||||
$this->consoleStyle->title(sprintf('%d available levels:', count($levels)));
|
||||
$this->consoleStyle->listing($levels);
|
||||
|
||||
return 0;
|
||||
return Shell::CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,6 +10,7 @@ use Rector\Autoloading\AdditionalAutoloader;
|
||||
use Rector\Configuration\Option;
|
||||
use Rector\Console\ConsoleStyle;
|
||||
use Rector\Console\Output\ProcessCommandReporter;
|
||||
use Rector\Console\Shell;
|
||||
use Rector\ConsoleDiffer\DifferAndFormatter;
|
||||
use Rector\FileSystem\FilesFinder;
|
||||
use Rector\Guard\RectorGuard;
|
||||
@ -165,7 +166,7 @@ final class ProcessCommand extends Command
|
||||
|
||||
if ($this->errors) {
|
||||
$this->processCommandReporter->reportErrors($this->errors);
|
||||
return 1;
|
||||
return Shell::CODE_ERROR;
|
||||
}
|
||||
|
||||
if ($input->getOption(Option::OPTION_WITH_STYLE)) {
|
||||
@ -179,7 +180,7 @@ final class ProcessCommand extends Command
|
||||
|
||||
$this->consoleStyle->success('Rector is done!');
|
||||
|
||||
return 0;
|
||||
return Shell::CODE_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
19
src/Console/Shell.php
Normal file
19
src/Console/Shell.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Rector\Console;
|
||||
|
||||
/**
|
||||
* Mimics https://github.com/cakephp/cakephp/blob/ae7ec50e12adbb30d9e7d1187b385bc32b7d31dc/src/Console/Shell.php#L39
|
||||
*/
|
||||
final class Shell
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const CODE_ERROR = 1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const CODE_SUCCESS = 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user