These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Yajra\DataTables\Html\Editor; |
||
4 | |||
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') |
||
48 | { |
||
49 | $this->instance = $instance; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * Make new Editor instance. |
||
54 | * |
||
55 | * @param string $instance |
||
56 | * @return Editor |
||
57 | */ |
||
58 | public static function make($instance = 'editor') |
||
59 | { |
||
60 | return new static($instance); |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * Append raw scripts. |
||
65 | * |
||
66 | * @param string $scripts |
||
67 | * @return Editor |
||
68 | */ |
||
69 | public function scripts($scripts) |
||
70 | { |
||
71 | $this->scripts = $scripts; |
||
72 | |||
73 | return $this; |
||
74 | } |
||
75 | |||
76 | /** |
||
77 | * Set Editor's variable name / instance. |
||
78 | * |
||
79 | * @param $instance |
||
80 | * @return $this |
||
81 | */ |
||
82 | public function instance($instance) |
||
83 | { |
||
84 | $this->instance = $instance; |
||
85 | |||
86 | return $this; |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * Set Editor's ajax parameter. |
||
91 | * |
||
92 | * @param string|array $ajax |
||
93 | * @return $this |
||
94 | */ |
||
95 | public function ajax($ajax) |
||
96 | { |
||
97 | $this->ajax = $ajax; |
||
0 ignored issues
–
show
|
|||
98 | |||
99 | return $this; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Set Editor's table source. |
||
104 | * |
||
105 | * @param string $table |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function table($table) |
||
109 | { |
||
110 | $this->table = $table; |
||
111 | |||
112 | return $this; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * Set Editor's fields. |
||
117 | * |
||
118 | * @param array $fields |
||
119 | * @return $this |
||
120 | */ |
||
121 | public function fields(array $fields) |
||
122 | { |
||
123 | $this->fields = $fields; |
||
0 ignored issues
–
show
It seems like
$fields of type array is incompatible with the declared type string of property $fields .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..
Loading history...
|
|||
124 | |||
125 | return $this; |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | * Set Editor's language. |
||
130 | * |
||
131 | * @param array $language |
||
132 | * @return $this |
||
133 | */ |
||
134 | public function language(array $language) |
||
135 | { |
||
136 | $this->language = $language; |
||
137 | |||
138 | return $this; |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Set Editor's template. |
||
143 | * |
||
144 | * @param string $template |
||
145 | * @return $this |
||
146 | */ |
||
147 | public function template($template) |
||
148 | { |
||
149 | $this->template = $template; |
||
150 | |||
151 | return $this; |
||
152 | } |
||
153 | } |
||
154 |
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.