【发布时间】:2012-09-17 21:42:08
【问题描述】:
以下在php中是合法的。
class Foo{
function setBar($bar){
$this->bar = $bar;
}
}
有没有办法在使用前生成属性Foo#bar 尚未声明的通知?
我厌倦了浪费时间调试错别字。
【问题讨论】:
-
使用一个可以为你生成getter和setter的好IDE,你需要做的就是声明私有属性。 ZendStudio 浮现在脑海中
-
@Ibu 这可能有点离题,但有没有免费/低成本的 IDE 可以做到这一点?
-
@Panique 是的,你可以使用 Eclipse 进行 php 开发,Zend 是基于 Eclipse 的
-
除非您想从 Zend Studio 付费,否则 Eclipse 不会开箱即用。有一个插件 e-surf 但他们的更新站点目前似乎已关闭。我创建了一个代码模板(如下),它有助于 Preference->PHP->Editor->Templates : public function get${type}(){ return $$this->${variable}; } 公共函数 set${type}(${type} $$${variable}){ $$this->${variable} = $$${variable}; }
标签: php properties declaration error-reporting