<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
<?php

function generator()
{
    /* testYield */
    yield 1;

    /* testYieldFollowedByComment */
    YIELD/*comment*/ 2;

    /* testYieldFrom */
    yield from gen2();

    /* testYieldFromWithExtraSpacesBetween */
    Yield           From gen2();

    /* testYieldFromWithTabBetween */
    yield	from gen2();

    /* testYieldFromSplitByNewLines */
    yield

    FROM
    gen2();

    /* testYieldFromSplitByComment */
    yield /* comment */ from gen2();

    /* testYieldFromWithTrailingComment */
    yield // comment
    from gen2();

    /* testYieldFromWithTrailingAnnotation */
    yield // phpcs:ignore Stnd.Cat.Sniff -- for reasons.
    from gen2();

    /* testYieldFromSplitByNewLineAndComments */
    yield
    /* comment line 1
       line 2 */
    // another comment
    from
    gen2();

    /* testYieldFromSplitByNewLineAndAnnotation */
    YIELD
    // @phpcs:disable Stnd.Cat.Sniff -- for reasons.
    From
    gen2();
}

/* testYieldUsedAsClassName */
class Yield {
    /* testYieldUsedAsClassConstantName */
    const Type YIELD = 'foo';

    /* testYieldUsedAsMethodName */
    public function yield() {
        /* testYieldUsedAsPropertyName1 */
        echo $obj->yield;

        /* testYieldUsedAsPropertyName2 */
        echo $obj?->yield();

        /* testYieldUsedForClassConstantAccess1 */
        echo MyClass::YIELD;
        /* testFromUsedForClassConstantAccess1 */
        echo MyClass::FROM;
    }

    /* testYieldUsedAsMethodNameReturnByRef */
    public function &yield() {}
}

function myGen() {
    /* testYieldLiveCoding */
    yield
