Automattic\WooCommerce\Vendor\GraphQL\Language\AST

NodeList::offsetSetpublicWC 1.0ReturnTypeWillChange

Method of the class: NodeList{}

No Hooks.

Returns

null. Nothing (null).

Usage

$NodeList = new NodeList();
$NodeList->offsetSet( $offset, $value ): void;
$offset(int|string|null) (required)
.
$value(required)
.

NodeList::offsetSet() code WC 10.9.1

public function offsetSet($offset, $value): void
{
    if (is_array($value)) {
        /** @phpstan-var T $value */
        $value = AST::fromArray($value);
    }

    // Happens when a Node is pushed via []=
    if ($offset === null) {
        $this->nodes[] = $value;

        return;
    }

    $this->nodes[$offset] = $value;
}