title: How can I use PHPDoc to type-hint the parameters of a Callable?
body: <p>I have a method that accepts a callback as a parameter.  I would like to provide a signature in the PHPDoc for the <strong>class method</strong> that outlines the parameters for the <strong>callback function</strong> to be passed to that method so that my IDE (PHPStorm) can produce valid type hints for functions that are passed to my method, or at least someone looking at the code can determine the signature of the callback they're intended to provide.</p>
  <p>For example:</p>
  <pre class="lang-php prettyprint-override"><code>class Foo {
    public $items = [];
    /**
    * @param Callable(
    *   @param ArrayObject $items The list of items that bar() will return
    * ) $baz A callback to receive the items
    **/
    public function bar(Callable $baz) {
      $items = new ArrayObject($this-&gt;items);
      $baz($items);
    }
  }
  </code></pre>
  <p>The method <code>bar</code> has one parameter, <code>$baz</code>, which is a callback function.  Any function passed as an parameter to <code>bar()</code> must accept an <code>ArrayObject</code> as its only parameter.</p>
  <p>Ideally, it should be possible to include multiple parameters for the <code>Callable</code>, just like for any other method.</p>
  <p>When I write the following code:</p>
  <pre class="lang-php prettyprint-override"><code>$foo = new Foo();
  $foo-&gt;bar(function(
  </code></pre>
  <p>...I should then receive a parameter list that correctly hints the type (<code>ArrayObject</code>) of the accepted parameter for this function call.</p>
  <p>Is such a thing possible?  Does PHPStorm or another IDE support it?  Is there a recommended/standard way of documenting this even if there is no IDE support?</p>