1 | <?php |
||
8 | class MakeViewCommand extends Command |
||
9 | { |
||
10 | protected $signature = 'laradeck:view |
||
11 | {name : View name with dot syntax} |
||
12 | {--F|force : Rewrite exists view} |
||
13 | {--extends= : Extends directive} |
||
14 | {--section=* : Section directive} |
||
15 | {--stack=* : Push directive} |
||
16 | {--component=* : Component directive} |
||
17 | '; |
||
18 | |||
19 | protected $description = 'Create a new view'; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $view; |
||
25 | |||
26 | /** |
||
27 | * @var bool |
||
28 | */ |
||
29 | protected $force; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $extends; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $sections; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $stacks; |
||
45 | |||
46 | /** |
||
47 | * @var array |
||
48 | */ |
||
49 | protected $components; |
||
50 | |||
51 | public function __construct() |
||
55 | |||
56 | public function handle() |
||
76 | |||
77 | /** |
||
78 | * Get path of view file and create directories for it |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | protected function path(): string |
||
94 | |||
95 | /** |
||
96 | * Generate content of a view |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | protected function content(): string |
||
120 | |||
121 | /** |
||
122 | * Write content to a view |
||
123 | * |
||
124 | * @param string $path |
||
125 | * @param string $content |
||
126 | */ |
||
127 | protected function create(string $path, string $content) |
||
136 | |||
137 | /** |
||
138 | * @param $value |
||
139 | * @return array |
||
140 | */ |
||
141 | protected function parse($value): array |
||
155 | |||
156 | /** |
||
157 | * @param $name |
||
158 | * @param $type |
||
159 | * @return string |
||
160 | */ |
||
161 | protected function block($name, $type): string |
||
168 | |||
169 | /** |
||
170 | * @param string $key |
||
171 | * @param array $values |
||
172 | * @return string |
||
173 | */ |
||
174 | protected function blocks(string $key, array $values): string |
||
184 | } |
||
185 |
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.