1 | <?php |
||
26 | class Mailer |
||
27 | { |
||
28 | /** |
||
29 | * array of the recipient |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | |||
34 | protected $_toArray = []; |
||
35 | |||
36 | /** |
||
37 | * array of the sender |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | |||
42 | protected $_fromArray = []; |
||
43 | |||
44 | /** |
||
45 | * subject of the email |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | |||
50 | protected $_subject; |
||
51 | |||
52 | /** |
||
53 | * body of the email |
||
54 | * |
||
55 | * @var string|array |
||
56 | */ |
||
57 | |||
58 | protected $_body; |
||
59 | |||
60 | /** |
||
61 | * array of the attachments |
||
62 | * |
||
63 | * @var array |
||
64 | */ |
||
65 | |||
66 | protected $_attachmentArray = []; |
||
67 | |||
68 | /** |
||
69 | * built recipient contents |
||
70 | * |
||
71 | * @var string |
||
72 | */ |
||
73 | |||
74 | protected $_fromString; |
||
75 | |||
76 | /** |
||
77 | * built subject contents |
||
78 | * |
||
79 | * @var string |
||
80 | */ |
||
81 | |||
82 | protected $_subjectString; |
||
83 | |||
84 | /** |
||
85 | * built body contents |
||
86 | * |
||
87 | * @var string |
||
88 | */ |
||
89 | |||
90 | protected $_bodyString; |
||
91 | |||
92 | /** |
||
93 | * built header contents |
||
94 | * |
||
95 | * @var string |
||
96 | */ |
||
97 | |||
98 | protected $_headerString; |
||
99 | |||
100 | /** |
||
101 | * init the class |
||
102 | * |
||
103 | * @since 2.4.0 |
||
104 | * |
||
105 | * @param array $toArray array of the recipient |
||
106 | * @param array $fromArray array of the sender |
||
107 | * @param string $subject subject of the email |
||
108 | * @param string|array $body body of the email |
||
109 | * @param array|null $attachmentArray array of the attachments |
||
110 | */ |
||
111 | |||
112 | 4 | public function init(array $toArray = [], array $fromArray = [], string $subject = null, $body = null, ?array $attachmentArray = []) : void |
|
127 | |||
128 | /** |
||
129 | * create the recipient contents |
||
130 | * |
||
131 | * @since 2.0.0 |
||
132 | */ |
||
133 | |||
134 | 4 | protected function _createFromString() : void |
|
149 | |||
150 | /** |
||
151 | * create the subject contents |
||
152 | * |
||
153 | * @since 2.0.0 |
||
154 | */ |
||
155 | |||
156 | 4 | protected function _createSubjectString() : void |
|
176 | |||
177 | /** |
||
178 | * create the body contents |
||
179 | * |
||
180 | * @since 2.0.0 |
||
181 | */ |
||
182 | |||
183 | 4 | protected function _createBodyString() : void |
|
187 | |||
188 | /** |
||
189 | * create the header contents |
||
190 | * |
||
191 | * @since 2.0.0 |
||
192 | */ |
||
193 | |||
194 | 4 | protected function _createHeaderString() : void |
|
247 | |||
248 | /** |
||
249 | * send the email |
||
250 | * |
||
251 | * @since 2.6.2 |
||
252 | * |
||
253 | * @return bool |
||
254 | */ |
||
255 | |||
256 | 4 | public function send() : bool |
|
267 | } |
||
268 |
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
.