Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343696 - @var not working to help code assist
Summary: @var not working to help code assist
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact: Ilina Stefanova CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-24 04:14 EDT by Giorgio Liscio CLA
Modified: 2020-05-14 11:17 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Giorgio Liscio CLA 2011-04-24 04:14:50 EDT
Build Identifier: 20110218-0911

as there:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=260330
https://bugs.eclipse.org/bugs/show_bug.cgi?id=238505

class AAA
{
     /**
       * @return \AAA
       */
     static function test()
     {
          return new static();
     }
}

class BBB extends AAA
{
     function showme(){}
}

$instance = BBB::test();
when i want query code assist, i use this to help it, but it is not working no more

/** @var $instance \BBB */
/* @var $instance \BBB */
/** @var $instance BBB */
/* @var $instance \BBB */

these are all the tests i made, none works when:

$instance->


-------------------------------------------

simpler test case

class AAA{function hi(){}}

$obj = NULL;
/* @var $obj AAA */
$obj->                   here i should see code assist with hi() method

Reproducible: Always
Comment 1 Giorgio Liscio CLA 2011-04-24 04:36:52 EDT
sorry, the previous example works

here is the corrected testcase

class AAA{static function getInstance(){ return new static();}}
class BBB extends AAA{function showme(){}}

$aaa = BBB::getInstance();
/** @var $aaa \Atom\BBB */
$aaa->
Comment 2 Zhongwei Zhao CLA 2011-05-10 23:56:35 EDT
after investigation,I found /* @var $aaa \Atom\BBB */ works fine,but /** @var $aaa \Atom\BBB */ does not!
/** xxxx  */ is phpdoc,for tags in it,we should use

/**
 *  @var  \Atom\BBB 
 */
 instead of /** @var $aaa \Atom\BBB */
 more then 1 line,and no variable name.
 
 But now we still do not support it even you use:
 /**
 *  @var  \Atom\BBB 
 */
 
 I will ask Roy if we should support it.
 But I think /* @var $aaa \Atom\BBB */ is enough!
Comment 3 Roy Ganor CLA 2011-05-16 03:21:47 EDT
(In reply to comment #2)
> after investigation,I found /* @var $aaa \Atom\BBB */ works fine,but /** @var
> $aaa \Atom\BBB */ does not!
> /** xxxx  */ is phpdoc,for tags in it,we should use
> 
> /**
>  *  @var  \Atom\BBB 
>  */
>  instead of /** @var $aaa \Atom\BBB */
>  more then 1 line,and no variable name.
> 
>  But now we still do not support it even you use:
>  /**
>  *  @var  \Atom\BBB 
>  */
> 
>  I will ask Roy if we should support it.
>  But I think /* @var $aaa \Atom\BBB */ is enough!

The PHP lexer is the one to define the type hinting syntax. and according to it the only supported form is /* @var ... */

So we should not support the other annotation.

Thanks!
Comment 4 Giorgio Liscio CLA 2011-05-29 13:33:12 EDT
the problem is not the annotation, this is not working with ANY annotation

(still with latest pdt build)


class AAA{static function getInstance(){ return new static();}}
class BBB extends AAA{function showme(){}}

$aaa = BBB::getInstance();
/**
 * @var $aaa \Atom\BBB
 */
$aaa-> {here i should see showme(), but it is not here)
Comment 5 Giorgio Liscio CLA 2011-05-29 13:39:08 EDT
try this


namespace Atom
{

class AAA{static function getInstance(){ return new static();}}
class BBB extends AAA{function showme(){}}

$aaa = BBB::getInstance();
/**
 * @var $aaa \Atom\BBB
 */
$aaa-> {here i should see showme(), but it is not here)

}
Comment 6 Zhongwei Zhao CLA 2011-05-29 21:30:55 EDT
hey,you should use
/* @var $aaa \Atom\BBB */
	$aaa->

instead of

/**
* @var $aaa \Atom\BBB
*/
$aaa->
Comment 7 Giorgio Liscio CLA 2011-05-29 21:42:17 EDT
for the last time, NO, it does not work with ANY of the proposed notations

where is the difficulty to copy-paste my test case and see with your eyes that NO ONE of the proposed notations works?
Comment 8 Zhongwei Zhao CLA 2011-05-29 21:45:25 EDT
hmmm,it works fine in my development environment,not sure if you try the latest nightly build version.
Comment 9 Giorgio Liscio CLA 2011-05-29 21:47:51 EDT
give me the code that works
thanks
Comment 10 Zhongwei Zhao CLA 2011-05-29 21:50:27 EDT
<?php
namespace Atom {
	
	class AAA {
		static function getInstance() {
			return new static ();
		}
	}
	class BBB extends AAA {
		function showme() {
		}
	}
	
	$aaa = BBB::getInstance ();
/* @var $aaa \Atom\BBB */
	$aaa->


}
Comment 11 Giorgio Liscio CLA 2011-05-29 21:58:10 EDT
ok, in my build (latest stable) is not working at all
where i can get the trunk (windows, precompiled) ?
thank you
Comment 13 Giorgio Liscio CLA 2011-06-11 18:56:00 EDT
verified resolved in eclipse 3.7 pdt 3.0
thank you
Comment 14 Ilina Stefanova CLA 2011-08-02 09:02:08 EDT
Zhao's comment 10 is verified. Closing.