bind Dreamweaver for a particular code hint
I have this function:
function Q() {
return new Q();
}
Basically with it I Can do Q()->methods();
$var = new Q();
$var->methods();
Now my question is: is there a way to bind the function Q()
as it was new Q()
to have the classic code hint displayed?
Note I can referer to a more generic bind (consider I am using a Registry Pattern/Service Container), example:
function Q($which) {
if ($which==1)
return new FirstObj();
else
开发者_如何学Goreturn new SecondObj();
}
Q(1)->firstClassMethod();
Q(2)->secondClassMethod();
Q('otherClass')->otherClassMethod();
Unfortunately, no, you won't get code hints from Dreamweaver for this type of code. Dreamweaver does not execute the PHP code in order to determine what code hints to provide, as it would need to do for this type of "dynamic" object creation especially once you get to objects that themselves have different methods exposed based on what is passed into their constructors (think mixins).
精彩评论