Code completion on "$this" in an included file |
|
i don't get what you are trying to do with $this..
|
||||||||||||
|
|
I think my message is pretty clear willbaker..
|
||||||||||||
|
Guru master
|
Actually I agree with willbaker... How can you have a "$this" in an include file that is supposed to be a class defined in another file? Unless you are using $this as a regular variable and that's never a good idea... perhaps you can share a bit more code?
|
||||||||||||
|
|
Well, I'll try to be more clear then...
Template.php
myTemplate.tpl.php
an finally, let's say my code is ran with:
-------------- My problem: In "myTemplate.tpl.php" I'd like to let phpEd know that "$this" is an instance of the "Template" class, so phpEd can suggest me "echosafe()" when I type <?php $this-> I tried to let it know using the "@var Template" syntax, just above a $this variable in "myTemplate.tpl.php", but it doesn't seem to work! |
||||||||||||||||||
|
Guru master
|
Hmm that makes a lot more sense. And are you sure you did like
/** @var Template */ and not /* @var Template */ by mistake? PhpED only parses blocks if they start with 2 asterisks. |
||||||||||||
|
|
Yes, I did use "/** @var Template */" ,
This syntax always work, except for "$this". |
||||||||||||
|
Guru master
|
Guess PhpED doesn't allow override on $this then, although it probably should if it can't determine the type itself.
|
||||||||||||
|
Guru master
|
PhpED quite correctly always expects $this to represent the current class context and you can't reassign that. Because that template isn't within a class definition, I don't think you will get code completion to work on $this at coding time, although at run-time with debug, PhpED will be able to see the context of $this from the debugger.
However, this works:
Place your cursor after $_this-> and you get code completion. Because $_this is an assignment of $this (rather than a copy or clone), the new object works as expected. |
||||||||||||||
|
Code completion on "$this" in an included file |
|
||
Content © NuSphere Corp., PHP IDE team
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by
Powered by phpBB © phpBB Group, Design by phpBBStyles.com | Styles Database.
Powered by