code assistance inside included file for a variable defined outside
Let's say I create an object in index.php
and save the reference in the variable $obj
.
Late开发者_运维问答r in index.php
I include/require a file req.php
where I want to use a method of the object.
Is there a way to make Aptana 3.0.4 show me the available methods of the object when I type $obj->
inside req.php
?
I.e. Aptana should recognize that the variable $obj
is already defined higher in the file hierarchy and that it holds a reference to an object.
May be it helps if you add comment before the first var using
/* @var YOUR_CLASS */
The correct syntax in version 3.0.4 is like that:
/**
* @var Foobar
*/
$obj; // You have to call the variable here (redundant, I know)
$obj-> // will code assist the FooBar functions.
Since this is not that great of a syntax, I'm working on having additional support, like with the PDT special @var syntax:
/* @var $obj Foobar */
$obj-> // will code assist the FooBar functions.
Both should be supported in the Studio's next release.
Hope that helps
精彩评论