Skip to content

Commit

Permalink
[5.6] Throws an exception if the command doesn't exist (#23942)
Browse files Browse the repository at this point in the history
  • Loading branch information
KennedyTedesco authored and taylorotwell committed Apr 25, 2018
1 parent bfa0312 commit 2991de5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Illuminate/Console/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Application as SymfonyApplication;
use Symfony\Component\Console\Command\Command as SymfonyCommand;
use Symfony\Component\Console\Exception\CommandNotFoundException;
use Illuminate\Contracts\Console\Application as ApplicationContract;

class Application extends SymfonyApplication implements ApplicationContract
Expand Down Expand Up @@ -172,6 +173,10 @@ public function call($command, array $parameters = [], $outputBuffer = null)
$command = $this->laravel->make($command)->getName();
}

if (! $this->has($command)) {
throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $command));
}

array_unshift($parameters, $command);

$this->lastOutput = $outputBuffer ?: new BufferedOutput;
Expand Down

0 comments on commit 2991de5

Please sign in to comment.