1 | <?php |
||
9 | trait ConsoleMakeModuleCommand |
||
10 | { |
||
11 | /** |
||
12 | * The module name. |
||
13 | * |
||
14 | * @var string |
||
15 | */ |
||
16 | protected $moduleName; |
||
17 | |||
18 | /** |
||
19 | * The root namespace. |
||
20 | * |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $rootNamespace; |
||
24 | |||
25 | /** |
||
26 | * Get the destination class path. |
||
27 | * |
||
28 | * @param string $name |
||
29 | * |
||
30 | * @throws \Exception |
||
31 | * |
||
32 | * @return string |
||
33 | */ |
||
34 | protected function getPath($name): string |
||
44 | |||
45 | /** |
||
46 | * Get the root namespace for the class. |
||
47 | * |
||
48 | * @return string |
||
49 | */ |
||
50 | protected function rootNamespace(): string |
||
54 | |||
55 | /** |
||
56 | * Get the module name for the class. |
||
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | protected function moduleName(): string |
||
64 | |||
65 | /** |
||
66 | * Get the console command options. |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | protected function getOptions(): array |
||
76 | } |
||
77 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: