File tree Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Expand file tree Collapse file tree 3 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 12
12
if (PHP_VERSION_ID < 70300 ) {
13
13
if (!function_exists ('is_countable ' )) {
14
14
function is_countable ($ var ) {
15
- return is_array ($ var ) || $ var instanceof Countable;
15
+ return is_array ($ var )
16
+ || $ var instanceof Countable
17
+ || $ var instanceof ResourceBundle
18
+ || $ var instanceof SimpleXmlElement;
16
19
}
17
20
}
18
21
}
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ public function testIsCountable()
26
26
$ this ->assertTrue (is_countable (array (1 , 2 , '3 ' )));
27
27
$ this ->assertTrue (is_countable (new \ArrayIterator (array ('foo ' , 'bar ' , 'baz ' ))));
28
28
$ this ->assertTrue (is_countable (new \ArrayIterator ()));
29
+ $ this ->assertTrue (is_countable (new \SimpleXMLElement ('<foo><bar/><bar/><bar/></foo> ' )));
30
+ $ this ->assertTrue (is_countable (\ResourceBundle::create ('en ' , __DIR__ .'/fixtures ' )));
29
31
$ this ->assertFalse (is_countable (new \stdClass ()));
30
32
}
31
33
You can’t perform that action at this time.
0 commit comments