1 | <?php |
||
6 | class Data implements BuilderInterface |
||
7 | { |
||
8 | |||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | protected $data = []; |
||
13 | |||
14 | /** |
||
15 | * Data constructor. |
||
16 | * |
||
17 | * @param array|\ker0x\Push\Adapter\Fcm\Message\DataBuilder $dataBuilder The data we want to send. |
||
18 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidDataException |
||
19 | */ |
||
20 | public function __construct($dataBuilder) |
||
28 | |||
29 | /** |
||
30 | * Return data as an array. |
||
31 | * |
||
32 | * @return array |
||
33 | */ |
||
34 | public function build() |
||
38 | |||
39 | /** |
||
40 | * Build data from an array. |
||
41 | * |
||
42 | * @param array $dataArray Array of data for the notification. |
||
43 | * @return \ker0x\Push\Adapter\Fcm\Message\DataBuilder |
||
44 | * @throws \ker0x\Push\Adapter\Fcm\Message\Exception\InvalidDataException |
||
45 | */ |
||
46 | private function fromArray(array $dataArray) |
||
59 | } |
||
60 |
Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.
To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.
The function can be called with either null or an array for the parameter
$needle
but will only accept an array as$haystack
.