mirror of
https://github.com/php/php-src.git
synced 2024-09-23 10:57:26 +00:00
ce1d69a1f6
PHP requires integer typehints to be written "int" and does not allow "integer" as an alias. This changes type error messages to match the actual type name and avoids confusing messages like "must be of the type integer, integer given".
29 lines
591 B
PHP
29 lines
591 B
PHP
--TEST--
|
|
SPL: RegexIterator::setMode() error tests
|
|
--CREDITS--
|
|
Felix De Vliegher <felix.devliegher@gmail.com>
|
|
--FILE--
|
|
<?php
|
|
|
|
$array = array('foo', 'bar', 'baz');
|
|
$regexIterator = new RegexIterator(new ArrayIterator($array), "/f/");
|
|
|
|
var_dump($regexIterator->getMode());
|
|
|
|
try {
|
|
$regexIterator->setMode(7);
|
|
} catch (InvalidArgumentException $e) {
|
|
var_dump($e->getMessage());
|
|
var_dump($e->getCode());
|
|
}
|
|
|
|
$regexIterator->setMode('foo');
|
|
|
|
?>
|
|
--EXPECTF--
|
|
int(0)
|
|
string(14) "Illegal mode 7"
|
|
int(0)
|
|
|
|
Warning: RegexIterator::setMode() expects parameter 1 to be int, string given in %s on line %d
|