src/DataKeyAwareTrait.php
protected function _setDataKey($key)
    {
        if (!is_null($key) && !is_string($key) && !($key instanceof Stringable)) {
            throw $this->_createInvalidArgumentException($this->__('Data key must be a string or stringable'), 0, null, $key);
        }

        $this->dataKey = $key;

        return $this;
    }
protected function _setDataKey($key)
    {
        if (!is_null($key) && !is_string($key) && !($key instanceof Stringable)) {
            throw $this->_createInvalidArgumentException($this->__('Data key must be a string or stringable'), 0, null, $key);
        }

        $this->dataKey = $key;

        return $this;
    }
Assigns a data key to this instance.

@since [*next-version*]

@param string|Stringable|null $key The key.

@throws InvalidArgumentException If the key is invalid.