Autocompletion with /** @var */ in closures

Hello everybody,

I don't know if it's a bug (if so I'll gladly make a real bug report) or just me, but I can't get autocompletion in a closure on the following kind of code :
It's written in a Symfony2 controller and use the Symfony2 DIC.

<?php
/** @var \MyBundle\Model\Checkout\Manager $manager */
$manager = $this->container->get('my_bundle.checkout_manager');

/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher */
$eventDispatcher = $this->container->get('event_dispatcher');

// Create an event listener for the cart update
$eventDispatcher->addListener('cart.update', function() use ($manager) {
    $manager->onCartUpdate(); // no autocompletion here on $manager and the method ->onCartUpdate is not recognized.
});
?>

But if I duplicate the /** @var */ comment inside the closure, then it works. Example:

<?php
/** @var \MyBundle\Model\Checkout\Manager $manager */
$manager = $this->container->get('my_bundle.checkout_manager');

/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher */
$eventDispatcher = $this->container->get('event_dispatcher');

// Create an event listener for the cart update
$eventDispatcher->addListener('cart.update', function() use ($manager) {

    /** @var \MyBundle\Model\Checkout\Manager $manager */
    $manager->onCartUpdate(); // works fine !
});
?>


Do you guys have any clue why?
Thanks for your support.

4 comments
Comment actions Permalink

Is there anybody here ?

0
Comment actions Permalink

I'm kinda feelin' alone...

0
Comment actions Permalink

Hi Dorian,

IMHO -- If you want guaranteed response and you are licensed user, then I think it will be better to contact support directly: support@jetbrains.com -- they are fast at responding.

Apparently all PHP-related devs are busy with upcoming v5, and only them (IMO of course) can tell you for sure if it is a bug or if it is supposed to be like that (missing feature/not implemented yet). If you feel that it is a bug (e.g. worked in previous versions), then feel free to submit new ticket on Issue Tracker (but please check for possible existing tickets first).

0
Comment actions Permalink

Thanks for your answer. I'll write them an email then. ;)

0

Please sign in to leave a comment.