src/AbstractCache.php
protected function assertKey($key): void
    {
        if (!is_string($key)) {
            $type = (is_object($key) ? get_class($key) . ' ' : '') . gettype($key);
            throw new InvalidArgumentException("Expected key to be a string, not $type");
        }

        if ($key === '' || preg_match('~[{}()/\\\\@:]~', $key)) {
            throw new InvalidArgumentException("Invalid key '$key'");
        }
    }
protected function assertKey($key): void
    {
        if (!is_string($key)) {
            $type = (is_object($key) ? get_class($key) . ' ' : '') . gettype($key);
            throw new InvalidArgumentException("Expected key to be a string, not $type");
        }

        if ($key === '' || preg_match('~[{}()/\\\\@:]~', $key)) {
            throw new InvalidArgumentException("Invalid key '$key'");
        }
    }
protected function assertKey ( $ key ) : void { if ( ! is_string ( $ key ) ) { $ type = ( is_object ( $ key ) ? get_class ( $ key ) . ' ' : '' ) . gettype ( $ key ) ; throw new InvalidArgumentException ( "Expected key to be a string, not $type" ) ; } if ( $ key === '' || preg_match ( '~[{}()/\\\\@:]~' , $ key ) ) { throw new InvalidArgumentException ( "Invalid key '$key'" ) ; } }
Validate the key

@param string $key
@return void
@throws InvalidArgumentException
Validate the key