Skip to content

Commit 1af12b4

Browse files
Improve make trait and interface commands code
1 parent eb94218 commit 1af12b4

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Illuminate/Foundation/Console/InterfaceMakeCommand.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class InterfaceMakeCommand extends GeneratorCommand
3535
*
3636
* @return string
3737
*/
38-
protected function getStub()
38+
protected function getStub(): string
3939
{
4040
return __DIR__.'/stubs/interface.stub';
4141
}
@@ -46,17 +46,17 @@ protected function getStub()
4646
* @param string $rootNamespace
4747
* @return string
4848
*/
49-
protected function getDefaultNamespace($rootNamespace)
49+
protected function getDefaultNamespace($rootNamespace): string
5050
{
51-
return $rootNamespace;
51+
return $rootNamespace.'\\Interfaces';
5252
}
5353

5454
/**
5555
* Get the console command arguments.
5656
*
5757
* @return array
5858
*/
59-
protected function getOptions()
59+
protected function getOptions(): array
6060
{
6161
return [
6262
['force', 'f', InputOption::VALUE_NONE, 'Create the interface even if the interface already exists'],

src/Illuminate/Foundation/Console/TraitMakeCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class TraitMakeCommand extends GeneratorCommand
3535
*
3636
* @return string
3737
*/
38-
protected function getStub()
38+
protected function getStub(): string
3939
{
4040
return $this->resolveStubPath('/stubs/trait.stub');
4141
}
@@ -46,7 +46,7 @@ protected function getStub()
4646
* @param string $stub
4747
* @return string
4848
*/
49-
protected function resolveStubPath($stub)
49+
protected function resolveStubPath($stub): string
5050
{
5151
return file_exists($customPath = $this->laravel->basePath(trim($stub, '/')))
5252
? $customPath
@@ -59,17 +59,17 @@ protected function resolveStubPath($stub)
5959
* @param string $rootNamespace
6060
* @return string
6161
*/
62-
protected function getDefaultNamespace($rootNamespace)
62+
protected function getDefaultNamespace($rootNamespace): string
6363
{
64-
return $rootNamespace;
64+
return $rootNamespace.'\\Traits';
6565
}
6666

6767
/**
6868
* Get the console command arguments.
6969
*
7070
* @return array
7171
*/
72-
protected function getOptions()
72+
protected function getOptions(): array
7373
{
7474
return [
7575
['force', 'f', InputOption::VALUE_NONE, 'Create the trait even if the trait already exists'],

0 commit comments

Comments
 (0)