PHP 5.3 and interface \ArrayAccess
<p>I'm now working on a project and I have one class that implements the ArrayAccess interface.</p>

<p>Howewer, I'm getting an error that says that my implementation:</p>

<p><em>must be compatible with that of ArrayAccess::offsetSet().</em></p>

<p>My implementation looks like this:</p>

<pre><code>public function offsetSet($offset, $value) {
  if (!is_string($offset)) {
    throw new \LogicException("...");
  }
  $this-&gt;params[$offset] = $value;
}
</code></pre>

<p>So, to me it looks like my implementation is correct. Any idea what is wrong? Thanks very much!</p>

<p>The class look like this:</p>

<pre><code>class HttpRequest implements \ArrayAccess {
  // tons of private variables, methods for working
  // with current http request etc. Really nothing that
  // could interfere with that interface.

  // ArrayAccess implementation

  public function offsetExists($offset) {
    return isset ($this-&gt;params[$offset]);
  }

  public function offsetGet($offset) {
    return isset ($this-&gt;params[$offset]) ? $this-&gt;params[$offset] : NULL;
  }

  public function offsetSet($offset, $value) {
     if (!is_string($offset)) {
      throw new \LogicException("You can only assing to params using specified key.");
     }
     $this-&gt;params[$offset] = $value;
  }

  public function offsetUnset($offset) {
    unset ($this-&gt;params[$offset]);
  }
}
</code></pre>
