php-src/Zend/tests/generators/throw_not_an_exception.phpt
Nikita Popov be7b0bc3ec Implement Generator::throw() method
Generator::throw($exception) throws an exception into the generator. The
exception is thrown at the current point of suspension within the generator.
It basically behaves as if the current yield statement were replaced with
a throw statement and the generator subsequently resumed.
2012-12-24 00:27:55 +01:00

16 lines
272 B
PHP

--TEST--
Generator::throw() with something that's not an exception
--FILE--
<?php
function gen() {
yield;
}
$gen = gen();
$gen->throw(new stdClass);
?>
--EXPECTF--
Fatal error: Exceptions must be valid objects derived from the Exception base class in %s on line %d