1 | <?php |
||
10 | class FormMakeCommand extends GeneratorCommand |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * The console command name. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name = 'make:form'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Create a form builder class'; |
||
26 | |||
27 | /** |
||
28 | * Type of the file generated. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $type = 'Form'; |
||
33 | |||
34 | /** |
||
35 | * @var FormGenerator |
||
36 | */ |
||
37 | private $formGenerator; |
||
38 | |||
39 | public function __construct(Filesystem $files, FormGenerator $formGenerator) |
||
44 | |||
45 | /** |
||
46 | * Get the console command arguments. |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | protected function getArguments() |
||
56 | |||
57 | /** |
||
58 | * Get the console command options. |
||
59 | * |
||
60 | * @return array |
||
61 | */ |
||
62 | protected function getOptions() |
||
63 | { |
||
64 | return array( |
||
65 | array('fields', null, InputOption::VALUE_OPTIONAL, 'Fields for the form'), |
||
66 | array('namespace', null, InputOption::VALUE_OPTIONAL, 'Class namespace'), |
||
67 | array('path', null, InputOption::VALUE_OPTIONAL, 'File path') |
||
68 | ); |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * Replace the class name for the given stub. |
||
73 | * |
||
74 | * @param string $stub |
||
75 | * @param string $name |
||
76 | * @return string |
||
77 | */ |
||
78 | protected function replaceClass($stub, $name) |
||
94 | |||
95 | /** |
||
96 | * Replace the namespace for the given stub. |
||
97 | * |
||
98 | * @param string $stub |
||
99 | * @param string $name |
||
100 | * @return $this |
||
101 | */ |
||
102 | protected function replaceNamespace(&$stub, $name) |
||
124 | |||
125 | /** |
||
126 | * Get the stub file for the generator. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | protected function getStub() |
||
134 | |||
135 | /** |
||
136 | * Get psr-4 namespace. |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | protected function getAutoload() |
||
152 | |||
153 | /** |
||
154 | * Get the desired class name from the input. |
||
155 | * |
||
156 | * @return string |
||
157 | */ |
||
158 | protected function getNameInput() |
||
162 | |||
163 | /** |
||
164 | * @inheritdoc |
||
165 | */ |
||
166 | protected function getPath($name) |
||
180 | } |
||
181 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.