码迷,mamicode.com
首页 > 其他好文 > 详细

彻底解决zend studio 下 assignment in condition警告

时间:2014-11-09 19:29:57      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   使用   on   2014   log   代码   

最近在mac系统下安装zend studio作为php开发工具,把以前的代码导入,发现项目中有很多 “assignment in condition”的警告,造成原因是在条件判断的if、while中使用了如下类似的做法:

if ($res = $other)

while (($row = $res->fetchRow(DB_FETCHMODE_OBJECT))) 

想去掉这个警告有多种方法,这里列出两种,第一种是从代码的角度,把代码写的更健壮,例如:

if (($res = $other) != FALSE)

while (($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) != FALSE) 

但是往往项目中会使用到第三方php代码,第三方代码可能会有大量这种警告,如果自己逐个修改,那还是一件比较麻烦的事,这里提供的第二种方法是通过修改zend studio设置,彻底忽略这类警告提示信息。

具体设置为,依次打开 偏好设置 –> PHP –> Semantic Analysis Properties,展开右边Potential Programmer Problems,在其下面可以找到“Assignment in condition(e.g. ‘if(a=b)’),把Warning修改Ignore,保存设置就彻底去掉这个警告提示了。

bubuko.com,布布扣

彻底解决zend studio 下 assignment in condition警告

标签:blog   http   io   ar   使用   on   2014   log   代码   

原文地址:http://www.cnblogs.com/doseoer/p/4085709.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!