1 | <?php |
||
14 | class Cell |
||
15 | { |
||
16 | /** |
||
17 | * Numeric cell type (whole numbers, fractional numbers, dates) |
||
18 | */ |
||
19 | const TYPE_NUMERIC = 0; |
||
20 | |||
21 | /** |
||
22 | * String (text) cell type |
||
23 | */ |
||
24 | const TYPE_STRING = 1; |
||
25 | |||
26 | /** |
||
27 | * Formula cell type |
||
28 | * Not used at the moment |
||
29 | */ |
||
30 | const TYPE_FORMULA = 2; |
||
31 | |||
32 | /** |
||
33 | * Empty cell type |
||
34 | */ |
||
35 | const TYPE_EMPTY = 3; |
||
36 | |||
37 | /** |
||
38 | * Boolean cell type |
||
39 | */ |
||
40 | const TYPE_BOOLEAN = 4; |
||
41 | |||
42 | /** |
||
43 | * Error cell type |
||
44 | */ |
||
45 | const TYPE_ERROR = 5; |
||
46 | |||
47 | /** |
||
48 | * The value of this cell |
||
49 | * @var mixed|null |
||
50 | */ |
||
51 | protected $value = null; |
||
52 | |||
53 | /** |
||
54 | * The cell type |
||
55 | * @var int|null |
||
56 | */ |
||
57 | protected $type = null; |
||
58 | |||
59 | /** |
||
60 | * The cell style |
||
61 | * @var Style|null |
||
62 | */ |
||
63 | protected $style = null; |
||
64 | |||
65 | /** |
||
66 | * @var StyleMerger |
||
67 | */ |
||
68 | protected $styleMerger; |
||
69 | |||
70 | /** |
||
71 | * Cell constructor. |
||
72 | * @param $value mixed |
||
73 | * @param $style|null Style |
||
74 | */ |
||
75 | 97 | public function __construct($value, Style $style = null) |
|
81 | |||
82 | /** |
||
83 | * @param $value mixed|null |
||
84 | */ |
||
85 | 97 | public function setValue($value) |
|
90 | |||
91 | /** |
||
92 | * @return mixed|null |
||
93 | */ |
||
94 | 91 | public function getValue() |
|
98 | |||
99 | /** |
||
100 | * @param Style $style |
||
101 | */ |
||
102 | 1 | public function setStyle(Style $style) |
|
106 | |||
107 | /** |
||
108 | * @return Style|null |
||
109 | */ |
||
110 | 1 | public function getStyle() |
|
117 | |||
118 | /** |
||
119 | * @return int|null |
||
120 | */ |
||
121 | public function getType() |
||
125 | |||
126 | /** |
||
127 | * Get the current value type |
||
128 | * @param mixed|null $value |
||
129 | * @return int |
||
130 | */ |
||
131 | 97 | protected function detectType($value) |
|
145 | |||
146 | /** |
||
147 | * @return bool |
||
148 | */ |
||
149 | public function isBoolean() |
||
153 | |||
154 | /** |
||
155 | * @return bool |
||
156 | */ |
||
157 | public function isEmpty() |
||
161 | |||
162 | /** |
||
163 | * Not used at the moment |
||
164 | * @return bool |
||
165 | */ |
||
166 | public function isFormula() |
||
170 | |||
171 | /** |
||
172 | * @return bool |
||
173 | */ |
||
174 | public function isNumeric() |
||
178 | |||
179 | /** |
||
180 | * @return bool |
||
181 | */ |
||
182 | 1 | public function isString() |
|
186 | |||
187 | /** |
||
188 | * @return bool |
||
189 | */ |
||
190 | public function isError() |
||
194 | |||
195 | /** |
||
196 | * @return string |
||
197 | */ |
||
198 | public function __toString() |
||
202 | |||
203 | /** |
||
204 | * @param Style $style|null |
||
205 | * @return Cell |
||
206 | */ |
||
207 | public function applyStyle(Style $style = null) |
||
216 | } |
||
217 |
It seems like you allow that null is being passed for a parameter, however the function which is called does not seem to accept null.
We recommend to add an additional type check (or disallow null for the parameter):