Skip to content

Commit

Permalink
Don't overwrite published stub files by default (#32038)
Browse files Browse the repository at this point in the history
  • Loading branch information
misenhower committed Mar 20, 2020
1 parent 514dff2 commit fc72e94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Illuminate/Foundation/Console/StubPublishCommand.php
Expand Up @@ -12,7 +12,7 @@ class StubPublishCommand extends Command
*
* @var string
*/
protected $signature = 'stub:publish';
protected $signature = 'stub:publish {--force : Overwrite any existing files}';

/**
* The console command description.
Expand Down Expand Up @@ -54,7 +54,9 @@ public function handle()
];

foreach ($files as $from => $to) {
file_put_contents($to, file_get_contents($from));
if (! file_exists($to) || $this->option('force')) {
file_put_contents($to, file_get_contents($from));
}
}

$this->info('Stubs published successfully.');
Expand Down

0 comments on commit fc72e94

Please sign in to comment.