Code completion for objects assigned to variables |
Site Admin
|
No, you're not forced at all. Please read Type Hints topic. |
||||||||||||||
_________________ The PHP IDE team |
|
Thanks for the information dmitri. So in my example, I had to place the following text directly above the function "getPersonById" that returned a Person.
/** * @return Person */ However, it is still an extra step above all functions that return objects. It would be so nice for it to just know. Perhaps it's a limitation of PHP? |
||||||||||||
|
Site Admin
|
not at all. If your function has something like below: $a=new myobject(); return $a; it will be recognized as returning myobject without any type hints. Also it will be recognized if it returns class property of a known type and so on. In other words, your function should be "clear" enough to be recognized. Otherwise, you'd add type hint. |
||||||||||||||
_________________ The PHP IDE team |
|
Code is as you say, and is returning a clear object. The IDE doesn't recognize it as object.
In other words, with a fake example... Working $a = new Person(x,x,x,x); $a-> //code completion works Not Working function getPerson(){ $person = new Person(x,x,x,x); $person-> // code completion works here return $person } $aPerson = $this->getPerson(); $aPerson-> //code completion doesn't work here without type hint I would be more than happy to provide you with some screenshots if you would like to take this dicussion offline. Thank you! Chris |
||||||||||||
Last edited by cthorne66 on Wed Dec 10, 2008 11:14 pm; edited 1 time in total |
|
I should also mention that this issue is seen accros files. File A contains "function getPerson()" and file B is assigning the returned object to a variable.
|
||||||||||||
|
Code completion for objects assigned to variables |
|
||
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