File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
src/Clue/Redis/Protocol/Model Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,11 @@ class MultiBulkReply implements ModelInterface
19
19
* @param array|null $data
20
20
* @throws InvalidArgumentException
21
21
*/
22
- public function __construct (array $ data = null )
22
+ public function __construct ($ data = null )
23
23
{
24
+ if ($ data !== null && !is_array ($ data )) { // manual type check to support legacy PHP < 7.1
25
+ throw new InvalidArgumentException ('Argument #1 ($data) expected array|null ' );
26
+ }
24
27
$ this ->data = $ data ;
25
28
}
26
29
Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ protected function createModel($value)
11
11
return new MultiBulkReply ($ value );
12
12
}
13
13
14
+ public function testConstructWithInvalidDataThrows ()
15
+ {
16
+ $ this ->setExpectedException ('InvalidArgumentException ' , 'Argument #1 ($data) expected array|null ' );
17
+ new MultiBulkReply ('data ' );
18
+ }
19
+
14
20
public function testEmptyArray ()
15
21
{
16
22
$ model = $ this ->createModel (array ());
You can’t perform that action at this time.
0 commit comments