1 | <?php |
||
10 | class Background implements FilterInterface |
||
11 | { |
||
12 | /** |
||
13 | * @var ImagineInterface |
||
14 | */ |
||
15 | protected $imagine; |
||
16 | |||
17 | /** |
||
18 | * @var array|int[] |
||
19 | */ |
||
20 | protected $size; |
||
21 | |||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $color; |
||
26 | |||
27 | /** |
||
28 | * Constructor |
||
29 | * |
||
30 | * @param ImagineInterface $imagine |
||
31 | * @param array|int[] $size |
||
32 | * @param string $color |
||
33 | */ |
||
34 | 3 | public function __construct(ImagineInterface $imagine, $size = null, $color = '#fff') |
|
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | 2 | public function apply(ImageInterface $image) |
|
64 | } |
||
65 |
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
.