Neos\Flow\Cli\Response::setExitCode PHP Method

setExitCode() public method

Sets the numerical exit code which should be returned when exiting this application.
public setExitCode ( integer $exitCode ) : void
$exitCode integer
return void
    public function setExitCode($exitCode)
    {
        if (!is_integer($exitCode)) {
            throw new \InvalidArgumentException(sprintf('Tried to set invalid exit code. The value must be integer, %s given.', gettype($exitCode)), 1312222064);
        }
        $this->exitCode = $exitCode;
    }

Usage Example

 /**
  * Exits the CLI through the dispatcher and makes sure that Flow is properly shut down.
  *
  * If your command relies on functionality which is triggered through the Bootstrap
  * shutdown (such as the persistence framework), you must use quit() instead of exit().
  *
  * @param integer $exitCode Exit code to return on exit (see http://www.php.net/exit)
  * @throws StopActionException
  * @return void
  */
 protected function quit($exitCode = 0)
 {
     $this->response->setExitCode($exitCode);
     throw new StopActionException();
 }