Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Illuminate/Console/GeneratorCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,24 @@ protected function isReservedName($name)
return in_array($name, $this->reservedNames);
}

/**
* Checks whether the given class name is reserved or already exists.
*
* @return bool
*/
protected function isReservedOrExistingName()
{
if ($this->isReservedName($this->getNameInput())) {
return true;
}

if ($this->alreadyExists($this->getNameInput())) {
return true;
}

return false;
}

/**
* Get the first view directory path from the application configuration.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/ModelMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ protected function getOptions()
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) {
if ($this->isReservedOrExistingName() || $this->didReceiveOptions($input)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/ObserverMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ protected function getOptions()
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) {
if ($this->isReservedOrExistingName() || $this->didReceiveOptions($input)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/PolicyMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ protected function getOptions()
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) {
if ($this->isReservedOrExistingName() || $this->didReceiveOptions($input)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Console/TestMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected function getOptions()
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->isReservedName($this->getNameInput()) || $this->didReceiveOptions($input)) {
if ($this->isReservedOrExistingName() || $this->didReceiveOptions($input)) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Routing/Console/ControllerMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ protected function getOptions()
*/
protected function afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)
{
if ($this->didReceiveOptions($input)) {
if ($this->isReservedOrExistingName() || $this->didReceiveOptions($input)) {
return;
}

Expand Down