1.2.1463. Yield From Usage

Usage of generator <https://www.php.net/`generator>`_ delegation, with yield from keyword.

In PHP 7, generator <https://www.php.net/`generator>`_ delegation allows you to yield values from another Generator, Traversable object, or array by using the yield from.

Yield from was introduced in PHP 7.1, and is backward incompatible.

<?php

// Yield delegation
function foo() {
    yield from bar();
}

function bar() {
    yield 1;
}

?>

See also Generator Syntax and Understanding PHP Generators.

1.2.1463.1. Connex PHP features

1.2.1463.1.1. Specs

Short name

Php/YieldFromUsage

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.8.4

PHP Version

With PHP 7.0 and more recent

Severity

Time To Fix

Precision

Very high

Available in

Entreprise Edition, Community Edition, Exakat Cloud