1 | <?php |
||
8 | class ExtendCommand extends Command |
||
9 | { |
||
10 | /** |
||
11 | * The console command name. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $signature = 'admin:extend {extension} {--namespace=}'; |
||
16 | |||
17 | /** |
||
18 | * The console command description. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $description = 'Build a Laravel-admin extension'; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $basePath = ''; |
||
28 | |||
29 | /** |
||
30 | * @var Filesystem |
||
31 | */ |
||
32 | protected $filesystem; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $namespace; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $className; |
||
43 | |||
44 | /** |
||
45 | * @var string |
||
46 | */ |
||
47 | protected $package; |
||
48 | |||
49 | /** |
||
50 | * @var string |
||
51 | */ |
||
52 | protected $extensionDir; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $dirs = [ |
||
58 | 'database/migrations', |
||
59 | 'database/seeds', |
||
60 | 'resources/assets', |
||
61 | 'resources/views', |
||
62 | 'src/Http/Controllers', |
||
63 | 'routes', |
||
64 | ]; |
||
65 | |||
66 | /** |
||
67 | * Execute the console command. |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | public function handle(Filesystem $filesystem) |
||
100 | |||
101 | /** |
||
102 | * Show extension scaffolding with tree structure. |
||
103 | */ |
||
104 | protected function showTree() |
||
130 | |||
131 | /** |
||
132 | * Make extension files. |
||
133 | */ |
||
134 | protected function makeFiles() |
||
188 | |||
189 | /** |
||
190 | * Get root namespace for this package. |
||
191 | * |
||
192 | * @return array|null|string |
||
193 | */ |
||
194 | protected function getRootNameSpace() |
||
206 | |||
207 | /** |
||
208 | * Get extension class name. |
||
209 | * |
||
210 | * @return string |
||
211 | */ |
||
212 | protected function getClassName() |
||
216 | |||
217 | /** |
||
218 | * Create package dirs. |
||
219 | */ |
||
220 | protected function makeDirs() |
||
226 | |||
227 | /** |
||
228 | * Validate extension name. |
||
229 | * |
||
230 | * @param string $name |
||
231 | * |
||
232 | * @return int |
||
233 | */ |
||
234 | protected function validateExtensionName($name) |
||
238 | |||
239 | /** |
||
240 | * Extension path. |
||
241 | * |
||
242 | * @param string $path |
||
243 | * |
||
244 | * @return string |
||
245 | */ |
||
246 | protected function extensionPath($path = '') |
||
256 | |||
257 | /** |
||
258 | * Put contents to file. |
||
259 | * |
||
260 | * @param string $to |
||
261 | * @param string $content |
||
262 | */ |
||
263 | protected function putFile($to, $content) |
||
269 | |||
270 | /** |
||
271 | * Copy files to extension path. |
||
272 | * |
||
273 | * @param string|array $from |
||
274 | * @param string|null $to |
||
275 | */ |
||
276 | protected function copy($from, $to = null) |
||
294 | |||
295 | /** |
||
296 | * Make new directory. |
||
297 | * |
||
298 | * @param array|string $paths |
||
299 | */ |
||
300 | protected function makeDir($paths) |
||
308 | } |
||
309 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.