summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/yield_unary_precedence.phpt
blob: 54eb0feb5f97da5bc2401bf5213060be01510f25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--TEST--
When + or - are used on yield, they must be unary (and not binary) (Bug #69160)
--FILE--
<?php
function gen() {
	var_dump(yield +1);
	var_dump(yield -1);
	var_dump(yield * -1); // other ops still should behave normally
}

for ($gen = gen(); $gen->valid(); $gen->send(1)) {
	echo "\n";
	var_dump($gen->current());
}
?>
--EXPECT--
int(1)
int(1)

int(-1)
int(1)

NULL
int(-1)