1.2.677. Method Is A Generator¶
This rule marks functions, methods, … that are using
yield
andyield from
keywords. The usage of that keyword makes them Generator <https://www.php.net/manual/en/class.`generator.php>`_, as is show by the compulsory return type ofGenerator
.
<?php
function generator() {
yield from generator2();
return 3;
}
function generator2() {
yield 1;
yield 2;
}
?>
See also Generators overview.
1.2.677.1. Specs¶
Short name |
Functions/IsGenerator |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Features |
generator, yield, yield-from |
Available in |