TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

56 lines
1.1 KiB

--TEST--
Only arrays and countable objects can be counted
--SKIPIF--
--FILE--
<?php
try {
$result = count(null);
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
$result = count("string");
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
$result = count(123);
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
$result = count(true);
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
$result = count(false);
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
try {
$result = count((object) []);
var_dump($result);
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
count(): Argument #1 ($value) must be of type Countable|array
count(): Argument #1 ($value) must be of type Countable|array
count(): Argument #1 ($value) must be of type Countable|array
count(): Argument #1 ($value) must be of type Countable|array
count(): Argument #1 ($value) must be of type Countable|array
int(1)