Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PDT » IMPORTANT: Code completion on class member Objects fix for PDT <2.x
IMPORTANT: Code completion on class member Objects fix for PDT <2.x [message #479721] Wed, 12 August 2009 03:51 Go to next message
Eclipse User
Originally posted by: mnm.criion.net

I have tested this only on Eclipse 3.3 and PDT 1.05
Others with older setups please add test results.

Courtesy of Mark Kirchner. Thank you Mark!
class FooClass {
/**
* @var BarClass
*/
public $Object;

public function __construct(BarClass $o) {
$this->Object = $o;
}

public function worker() {
$this->Object->|
}
}

class BarClass {
public function doSomething() {}
public function doSomeOtherThing() {}
}

Code-assist invoked at the "|"-position in worker() suggests both
methods of "BarClass".
--
-michael
Re: IMPORTANT: Code completion on class member Objects fix for PDT <2.x [message #479760 is a reply to message #479721] Wed, 12 August 2009 08:35 Go to previous messageGo to next message
exceptione is currently offline exceptione
Messages: 96
Registered: July 2009
Member
Michael Madsen schreef:
> I have tested this only on Eclipse 3.3 and PDT 1.05
> Others with older setups please add test results.
>
> Courtesy of Mark Kirchner. Thank you Mark!
> class FooClass {
> /**
> * @var BarClass
> */
> public $Object;
>
>

Erm, but this has always worked (minus the times pdt behaves buggy).
Please note that it is by necessity that you need to give an explicit
type annotation for $Object, the type inferencer would otherwise have no
idea what type $Object has.

-- Aside, I would recommend not to start variables with a capital. Now
it is more difficult to tell a variable part from a class name.
Re: IMPORTANT: Code completion on class member Objects fix for PDT <2.x [message #479782 is a reply to message #479760] Wed, 12 August 2009 09:33 Go to previous message
Eclipse User
Originally posted by: mnm.criion.net

True true I just didn't know it was implemented in PDT. I have asked for
this many times but no one seemed to know how to do it so I figured
maybe there were many who would like to know how :)

yes you are right regarding the naming of instance variables. It is a,
perhaps bad, habit because in PHP we have a sign in front of variables
making it easy to see if it's a variable or class name. But this is no
excuse for someone beating hard on the "best practice"-path.
--
-michael
Previous Topic:Completemy lost with PDT 2.1
Next Topic:how to set 'PHP Compare' by default?
Goto Forum:
  


Current Time: Thu May 23 04:08:19 EDT 2013

Powered by FUDForum. Page generated in 0.01625 seconds