1 | <?php |
||
5 | class Editor |
||
6 | { |
||
7 | /** |
||
8 | * @var string |
||
9 | */ |
||
10 | public $instance = ''; |
||
11 | |||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | public $ajax = ''; |
||
16 | |||
17 | /** |
||
18 | * @var string |
||
19 | */ |
||
20 | public $table = ''; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | public $template = ''; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | public $fields = ''; |
||
31 | |||
32 | /** |
||
33 | * @var array |
||
34 | */ |
||
35 | public $language = []; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | */ |
||
40 | public $scripts = ''; |
||
41 | |||
42 | /** |
||
43 | * Editor constructor. |
||
44 | * |
||
45 | * @param string $instance |
||
46 | */ |
||
47 | public function __construct($instance = 'editor') |
||
51 | |||
52 | /** |
||
53 | * Make new Editor instance. |
||
54 | * |
||
55 | * @param string $instance |
||
56 | * @return Editor |
||
57 | */ |
||
58 | public static function make($instance = 'editor') |
||
62 | |||
63 | /** |
||
64 | * Append raw scripts. |
||
65 | * |
||
66 | * @param string $scripts |
||
67 | */ |
||
68 | public function scripts($scripts) |
||
74 | |||
75 | /** |
||
76 | * Set Editor's variable name / instance. |
||
77 | * |
||
78 | * @param $instance |
||
79 | * @return $this |
||
80 | */ |
||
81 | public function instance($instance) |
||
87 | |||
88 | /** |
||
89 | * Set Editor's ajax parameter. |
||
90 | * |
||
91 | * @param string|array $ajax |
||
92 | * @return $this |
||
93 | */ |
||
94 | public function ajax($ajax) |
||
100 | |||
101 | /** |
||
102 | * Set Editor's table source. |
||
103 | * |
||
104 | * @param string $table |
||
105 | * @return $this |
||
106 | */ |
||
107 | public function table($table) |
||
113 | |||
114 | /** |
||
115 | * Set Editor's fields. |
||
116 | * |
||
117 | * @param array $fields |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function fields(array $fields) |
||
126 | |||
127 | /** |
||
128 | * Set Editor's language. |
||
129 | * |
||
130 | * @param array $language |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function language(array $language) |
||
139 | |||
140 | /** |
||
141 | * Set Editor's template. |
||
142 | * |
||
143 | * @param string $template |
||
144 | * @return $this |
||
145 | */ |
||
146 | public function template($template) |
||
152 | } |
||
153 |
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.