Type Hinting in PhpStorm of Object extending ArrayObject

Viewed 206

I would like to enable type hinting in PhpStorm for ArrayObject classes

My ArrayObject looks like this:

class MyArrayObject extends ArrayObject
{
     public function __construct()
     {
          $this['value1'] = new Class1();
          $this['value2'] = new Class1();             

     }
}

And I use it like

$MyObject = new MyArrayObject();

$MyObject['value1']->methodInClass1(); // methodInClass1 is not Hinted in PhpStorm.

I tried different approaches like to override an offsetGet() from the ArrayObject and to put @return on it but it doesn't work.

/** @return Class1 */
public function offsetGet($index) {
    return parent::offsetGet($index);
}

Is it possible at all to Type Hint the ArrayObject in PhpStorm?

0 Answers
Related