public function addItemBefore(mixed $object, string $latter_key, ?string $key = null) : void
    {
        // If the latter key doesn't exist, just add the item to the end.
        if (!isset($this->members[$latter_key])) {
            $this->addItem($object, $key);
            return;
        }
        $position = array_search($latter_key, array_keys($this->members));
        $this->array_insert($object, $key, $position);
    }