Cli/src/Exceptions/Command/InvalidCommandException.php

23 lines
771 B
PHP

<?php
namespace Nest\Cli\Exceptions\Command;
use Nest\Cli\Commands\CommandContext;
use Throwable;
/**
* Exception thrown when an invalid command has been used.
*/
class InvalidCommandException extends CommandException
{
/**
* @param string $invalidCommand Invalid command in context.
* @param CommandContext $commandContext Command context.
* @param int $code [optional] The Exception code.
* @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
*/
public function __construct(public string $invalidCommand, CommandContext $commandContext, int $code = 0, ?Throwable $previous = null)
{
parent::__construct($commandContext, "Invalid command $this->invalidCommand in this context.", $code, $previous);
}
}