1--TEST--
2Only arrays and countable objects can be counted
3--FILE--
4<?php
5
6try {
7    $result = count(null);
8    var_dump($result);
9} catch (\TypeError $e) {
10    echo $e->getMessage() . \PHP_EOL;
11}
12
13try {
14    $result = count("string");
15    var_dump($result);
16} catch (\TypeError $e) {
17    echo $e->getMessage() . \PHP_EOL;
18}
19
20try {
21    $result = count(123);
22    var_dump($result);
23} catch (\TypeError $e) {
24    echo $e->getMessage() . \PHP_EOL;
25}
26
27try {
28    $result = count(true);
29    var_dump($result);
30} catch (\TypeError $e) {
31    echo $e->getMessage() . \PHP_EOL;
32}
33
34try {
35    $result = count(false);
36    var_dump($result);
37} catch (\TypeError $e) {
38    echo $e->getMessage() . \PHP_EOL;
39}
40
41try {
42    $result = count((object) []);
43    var_dump($result);
44} catch (\TypeError $e) {
45    echo $e->getMessage() . \PHP_EOL;
46}
47
48?>
49--EXPECT--
50count(): Argument #1 ($value) must be of type Countable|array, null given
51count(): Argument #1 ($value) must be of type Countable|array, string given
52count(): Argument #1 ($value) must be of type Countable|array, int given
53count(): Argument #1 ($value) must be of type Countable|array, bool given
54count(): Argument #1 ($value) must be of type Countable|array, bool given
55count(): Argument #1 ($value) must be of type Countable|array, stdClass given
56