1.2.681. Method Is A Generator¶
This rule marks functions, methods, … that are using yield
and yield 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 of Generator
.
<?php
function generator() {
yield from generator2();
return 3;
}
function generator2() {
yield 1;
yield 2;
}
?>
See also Generators overview.
1.2.681.1. Connex PHP features¶
1.2.681.1.1. Specs¶
Short name |
Functions/IsGenerator |
Rulesets |
|
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
|
Time To Fix |
|
Precision |
Very high |
Available in |