summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/throw_not_an_exception.phpt
blob: 3b5a590096f4ff897a82c7b9a75af9a8070386ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
--TEST--
Generator::throw() with something that's not an exception
--FILE--
<?php

function gen() {
    yield;
}

$gen = gen();
$gen->throw(new stdClass);

?>
--EXPECTF--
Fatal error: Uncaught TypeError: Generator::throw(): Argument #1 ($exception) must be of type Throwable, stdClass given in %s:%d
Stack trace:
#0 %s(%d): Generator->throw(Object(stdClass))
#1 {main}
  thrown in %s on line %d