public function offsetSet($index, $newval)
    {
        $this->blockEndCache = [];

        if (!$this[$index] || !$this[$index]->equals($newval)) {
            $this->changed = true;

            if (isset($this[$index])) {
                $this->unregisterFoundToken($this[$index]);
            }

            $this->registerFoundToken($newval);
        }

        parent::offsetSet($index, $newval);
    }
public function offsetSet($index, $newval)
    {
        $this->blockEndCache = [];

        if (!$this[$index] || !$this[$index]->equals($newval)) {
            $this->changed = true;

            if (isset($this[$index])) {
                $this->unregisterFoundToken($this[$index]);
            }

            $this->registerFoundToken($newval);
        }

        parent::offsetSet($index, $newval);
    }
public function offsetSet ( $ index , $ newval ) { $ this -> blockEndCache = [ ] ; if ( ! $ this [ $ index ] || ! $ this [ $ index ] -> equals ( $ newval ) ) { $ this -> changed = true ; if ( isset ( $ this [ $ index ] ) ) { $ this -> unregisterFoundToken ( $ this [ $ index ] ) ; } $ this -> registerFoundToken ( $ newval ) ; } parent :: offsetSet ( $ index , $ newval ) ; }
Set collection item.

Warning! `$newval` must not be typehinted to be compatible with `ArrayAccess::offsetSet` method.

@param int   $index
@param Token $newval
Set collection item .