Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PDT » phpDoc @property tag not working.
phpDoc @property tag not working. [message #73646] Tue, 17 June 2008 10:23 Go to previous message
Eclipse User
Originally posted by: runar.b.olsen.gmail.com

Hi,

Lets say you have a class that acts as a registry and that contains the
magic methods __get($var) and __set($var, $value); Now for most of the
time you cannot be sure what type of variable __get will return but you
do know that __get('foo'); always will return a instance of the Foo
class. According to phpDoc (http://preview.tinyurl.com/2fxl57) you can
add the @property doc tag for the class defining that the property $foo
of the class Registery is a instance of Foo, but PDT does not seem to
take this into account when it comes to auto completing. Is this
something that will be included in a later release?

Example:

<?php

/**
* @property Foo $foo
*/
class Registry {
private $datastore = array();

public function __get($var) {
if(array_key_exists($var, $this->datastore) {
return $this->datastore[$var];
}
return false;
}
}

class Foo {
public function bar()
{
echo 'FooBar!';
}
}

$reg = new Registry();

// There is no foo in the auto complete list here
$foo = $reg->foo;
// Typing in $foo-> does not tell me about the bar method.
 
Read Message
Read Message
Read Message
Previous Topic:Debug Display view functionality
Next Topic:eclipse pdt editor not showing error
Goto Forum:
  


Current Time: Sat May 25 04:04:13 EDT 2013

Powered by FUDForum. Page generated in 0.01566 seconds