1

I know that in $Foo and in $array['Foo'] I have got stored the class Bar instance.

I expected the same result of using the @var annotation in both cases.

It works correctly:

/* @var $Foo Bar */
$Foo->| // [I see tips correctly]

But how to do that:

/* @var $array['Foo'] Bar */
$array['Foo']->| // [I want to see tips here, but nothing happens]

P.S. Sign | shows the Text Cursor position.

P.S.2. I tested this annotation on PhpStorm 7. Is not this IDE ready for this feature?

5
  • I haven't seen an IDE yet that recognizes associative values by their key. Commented Jul 22, 2015 at 14:27
  • 2
    @EvadeCaptcha Zend Studio Commented Jul 22, 2015 at 14:29
  • I'll have to check that one out. Commented Jul 22, 2015 at 14:30
  • Use local variable $foo = $array['Foo']; It will be work everywhere. This way more readable. Commented Jul 22, 2015 at 14:43
  • possible duplicate of PHPStorm Code Hinting for array of object arrays Commented Jul 22, 2015 at 14:50

1 Answer 1

1

This actually worked for me in PhpStorm 9. Maybe you should try upgrading: https://www.jetbrains.com/phpstorm/download/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.