original_string: public static function forKey($key, Exception $cause = null)
      {
          return new static(sprintf(
              'Expected a key of type integer or string. Got: %s',
              is_object($key) ? get_class($key) : gettype($key)
          ), 0, $cause);
      }
code: public static function forKey($key, Exception $cause = null)
      {
          return new static(sprintf(
              'Expected a key of type integer or string. Got: %s',
              is_object($key) ? get_class($key) : gettype($key)
          ), 0, $cause);
      }
code_tokens: public static function forKey ( $ key , Exception $ cause = null ) { return new static ( sprintf ( 'Expected a key of type integer or string. Got: %s' , is_object ( $ key ) ? get_class ( $ key ) : gettype ( $ key ) ) , 0 , $ cause ) ; }
docstring: Creates an exception for an invalid key.
  
  @param mixed          $key   The invalid key.
  @param Exception|null $cause The exception that caused this exception.
  
  @return static The created exception.
docstring_tokens: Creates an exception for an invalid key .