自动完成对PHP与PDT / Netbeans的类的对象? [英] Autocomplete for PHP Objects with classes in PDT/Netbeans?

查看:102
本文介绍了自动完成对PHP与PDT / Netbeans的类的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用新的像这样定义一个类的对象

When I define an object of a class using new like this

$blah = new Whatever();

我得到$嗒嗒自动完成。 但是我怎么做到这一点时,我有$等等作为函数参数?没有自动完成,我不完全的。

I get autocomplete for $blah. But how do I do it when I have $blah as a function parameter? Without autocomplete I am incomplete.

修改 如何做呢,如果它在一个包含和PDT或Netbeans的无法弄清楚有没有办法在声明类型变量? PHP?

Edit: How do I do it if it's in an include and PDT or Netbeans can't figure it out? Is there any way to declare types for variables in PHP?

推荐答案

在第一个注释的方法被称为类型提示,但你应该使用明智的。更好的解决方案是PHPDoc的。

Method in first comment is called "type hinting", but you should use that wisely. Better solution is phpDoc.

/**
 * Some description of function behaviour.
 *
 * @param Whatever $blah
 */
public function myFunction($blah)
{
    $blah-> 
    // Now $blah is Whatever object, autocompletion will work.
}

您也可以使用内嵌PHPDoc的评论这不完全是一回事。

You can also use an inline phpDoc comment which does exactly the same thing.

public function myFunction($blah)
{
    /* @var $blah Whatever  */
    $blah-> 
    // Now $blah is Whatever object, autocompletion will work.
}

这篇关于自动完成对PHP与PDT / Netbeans的类的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆