Reputation: 976
I'm using FOSUserBundle in my Symfony 2 application and was wondering how to make a code completion work in PHPStorm, because when you inject the service via container like:
$userManager = $this->container->get('fos_user.user_manager');
And trying to use $userManager to see its interface - I see nothing, because for PHPStorm this is a regular variable, not an object built via "new" operator.
Is there a way to make it show me the available methods for this object?
Like we usually do with real objects:
Thanks!
Upvotes: 3
Views: 874
Reputation: 3500
You have to assign to the variable an annotation like showed below to tell to phpstorm from which class the variable receive the instance (ps: I don't use fosUserBundle).
/** @var \myProject\appBundle\entityManager $userManager */
$userManager = $this->container->get('fos_user.user_manager');
PS: Have you installed the Symfony2 plugin?
Upvotes: 5