php-src/ext/spl/tests/SplObjectStorage_addAll_invalid_parameter.phpt
Gabriel Caruso fef879a2d6 Use bool instead of boolean while throwing a type error
PHP requires boolean typehints to be written "bool" and disallows
"boolean" as an alias. This changes the error messages to match
the actual type name and avoids confusing messages like "must be
of type boolean, boolean given".

This a followup to ce1d69a1f6, which
implements the same change for integer->int.
2018-02-04 23:09:40 +01:00

44 lines
1.1 KiB
PHP

--TEST--
Check that SplObjectStorage::addAll generate a warning and returns NULL when passed non-object param
--CREDITS--
PHPNW Testfest 2009 - Simon Westcott (swestcott@gmail.com)
--FILE--
<?php
$data_provider = array(
array(),
true,
"string",
12345,
1.2345,
NULL
);
foreach($data_provider as $input) {
$s = new SplObjectStorage();
var_dump($s->addAll($input));
}
?>
--EXPECTF--
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, array given in %s on line %d
NULL
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, bool given in %s on line %d
NULL
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, string given in %s on line %d
NULL
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, int given in %s on line %d
NULL
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, float given in %s on line %d
NULL
Warning: SplObjectStorage::addAll() expects parameter 1 to be SplObjectStorage, null given in %s on line %d
NULL