NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Can an included file be class-aware


Joined: 11 May 2008
Posts: 78
Reply with quote
Is it possible for an included file inside a class method to be class aware so if I write $this-> the autocompletion pops up with all class methods etc. I can choose from?

class A {
function f1() { }
function f2() { include file2.php; }
}

and inside file2.php:
$this-> // here I want autocompletion for the class A methods etc.

Maybe using some custom phpdoc at the start of file2, like @ofclass A, or something..

Thanks.

Edit:
I found the solution by myself, it was rather obvious.
I just document the first use of $this variable inside the included file with phpdoc ( /** @var MyClass */ ) and it works further on.
View user's profileFind all posts by tedychSend private message
Can an included file be class-aware
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic