[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.pdt] phpDoc @property tag not working.

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.