title: PHP Type Hinting: array supported, object NOT?
body: <p>Am I missing something or there really is no support for generic object type hinting in PHP 5.x?</p>
  
  <p>I find it really strange that hinting arrays is supported while hinting objects is not, at least not out of the box.</p>
  
  <p>I'd like to have something like this:</p>
  
  <pre><code>function foo(object $o)
  </code></pre>
  
  <p>Just as we have:</p>
  
  <pre><code>function foo(array $o)
  </code></pre>
  
  <p>Example of possible use: methods of an objects collection class.</p>
  
  <p>Workaround: using an interface "Object" implemented by all classes or extending all classes from a generic class "Object" and writing something like this:</p>
  
  <pre><code>function foo(Object $o)
  </code></pre>
  
  <p>Well, that just ain't cute.</p>
  
  <p>Using <code>stdClass</code> as the type hint doesn't work:</p>
  
  <blockquote>
    <p>Catchable fatal error: Argument 1
    passed to c::add() must be an instance
    of stdClass, instance of b given</p>
  </blockquote>