相关疑难解决方法(0)

使用magic __get()时私有/受保护成员变量的代码完成

在处理具有私有或受保护成员变量的类时,如何设置代码完成以在Zend Studio(或任何基于Eclipse的IDE)上工作,而不使用一堆Getter或将成员变量设置为public.

例如:

class Dog {

    protected $bark = 'woof!';

    public function __get($key) {
        if (isset($this->$key)) {
            return $this->$key;
        }
    }

}

$Dog = new Dog();
echo $Dog->bark; // <-- I want the IDE to "know" that bark is a property of Dog.
Run Code Online (Sandbox Code Playgroud)

php eclipse zend-studio code-completion

12
推荐指数
1
解决办法
4206
查看次数

标签 统计

code-completion ×1

eclipse ×1

php ×1

zend-studio ×1