mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00

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.
44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
--TEST--
|
|
Check that SplObjectStorage::removeAllExcept generate a warning and returns NULL when passed non-object param
|
|
--CREDITS--
|
|
Matthew Turland (me@matthewturland.com)
|
|
Based on work done at PHPNW Testfest 2009 by 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->removeAllExcept($input));
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, array given in %s on line %d
|
|
NULL
|
|
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, bool given in %s on line %d
|
|
NULL
|
|
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, string given in %s on line %d
|
|
NULL
|
|
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, int given in %s on line %d
|
|
NULL
|
|
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, float given in %s on line %d
|
|
NULL
|
|
|
|
Warning: SplObjectStorage::removeAllExcept() expects parameter 1 to be SplObjectStorage, null given in %s on line %d
|
|
NULL
|
|
|