private void lockChain() {
        if (!isLocked) {
            isLocked = true;
        }
    }
Lock the chain so no more iterators can be added.
This must be called from all Iterator interface methods.
jphp-runtime/src/php/runtime/common/collections/iterators/IteratorChain.java