1 | <?php |
||
8 | class EnumMakeCommand extends GeneratorCommand |
||
9 | { |
||
10 | /** |
||
11 | * The console command name. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $name = 'make:enum'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Create a new enum class'; |
||
23 | |||
24 | /** |
||
25 | * The type of class being generated. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $type = 'Enum'; |
||
30 | |||
31 | /** |
||
32 | * Get the stub file for the generator. |
||
33 | * |
||
34 | * @return string |
||
35 | */ |
||
36 | 12 | protected function getStub() |
|
40 | |||
41 | /** |
||
42 | * Get the default namespace for the class. |
||
43 | * |
||
44 | * @param string $rootNamespace |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | 12 | protected function getDefaultNamespace($rootNamespace) |
|
52 | |||
53 | /** |
||
54 | * Build the class with the given name. |
||
55 | * |
||
56 | * @param string $name |
||
57 | * @return string |
||
58 | * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException |
||
59 | */ |
||
60 | 12 | protected function buildClass($name) |
|
70 | |||
71 | /** |
||
72 | * Get the console command arguments. |
||
73 | * |
||
74 | * @return array |
||
75 | */ |
||
76 | 12 | protected function getArguments() |
|
82 | |||
83 | /** |
||
84 | * Get the constants for the enum. |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 12 | protected function getConstants() |
|
105 | |||
106 | /** |
||
107 | * Replace the docblock for the given stub. |
||
108 | * |
||
109 | * @param string $stub |
||
110 | * |
||
111 | * @return $this |
||
112 | */ |
||
113 | 12 | protected function replaceDocblock(&$stub) |
|
124 | |||
125 | /** |
||
126 | * Replace the constants for the given stub. |
||
127 | * |
||
128 | * @param string $stub |
||
129 | * |
||
130 | * @return $this |
||
131 | */ |
||
132 | 12 | protected function replaceConstants(&$stub) |
|
143 | } |
||
144 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.