From bc20aaa0ef07682cf0ef7d4c9eb1b11456c0f07e Mon Sep 17 00:00:00 2001 From: Kennedy Tedesco Date: Tue, 17 Apr 2018 12:51:09 -0300 Subject: [PATCH] [5.6] Throws an exception if the command doesn't exist --- src/Illuminate/Console/Application.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Illuminate/Console/Application.php b/src/Illuminate/Console/Application.php index add753d16022..aa3ac182f299 100755 --- a/src/Illuminate/Console/Application.php +++ b/src/Illuminate/Console/Application.php @@ -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 @@ -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;