mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
be7b0bc3ec
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.
16 lines
272 B
PHP
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
|