[Code Assist] Code assist in included files ? [message #45883] |
Thu, 23 August 2007 19:41 |
Eclipse User |
|
|
|
Originally posted by: user.domain.invalid
Hello. This is my first post in this group.
If I have the following class :
-[Module.php]--------------------------------
class Module {
function execute() {
include('action.php');
}
function foo() {
// Do something
}
}
---------------------------------------------
And the following file :
-[action.php]-----------------------------------
$this->foo();
---------------------------------------------
This is valid PHP code but code assist can not work
in the "action.php" file as the editor doesn't know
what "$this" can be.
Is there a way to make code assist work with a workaround ?
The simpliest trick I've found is the following :
-[Module.php]--------------------------------
/**
* @return Module
*/
function thisModule($module) {
return $module;
}
class Module {
function execute() {
include('action.php');
}
function foo() {
// Do something
}
}
---------------------------------------------
-[action.php]--------------------------------
$This=thisModule($this);
$This->foo();
---------------------------------------------
That works almost good (it gives code assist for all public method,
which is a good start)
Has anyone something lighter ? I look especially for a method that does
not imply the declaration of a specific function (like "thisModule()")
for each class.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03554 seconds