NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
areeda
Joined: 28 Aug 2008 Posts: 469 Location: Los Angeles
|
Posted: Sat Sep 13, 2008 10:18 pm Post subject: PHP Style (Editor warning) question |
|
|
My issue is with a statement like:
| Code: | | while($f = mysql_fetch_assoc($res)) |
It rightfully gives a warning about a possible accidental assignment.
In previous version of NB in PHP and Java this warning could be avoided by explicitly testing the result like
| Code: | | while (($f = mysql_fetch_assoc($res)) != NULL) |
But no longer (I'm using fairly recent nightly builds).
I cannot think of a way to do this without duplicating the assignment statement and risk having them be different, sometimes they are a lot more complicated.
How are others dealing with this warning? I do know I can turn that off but it's saved me more than once from using A=B when I meant A==B.
Thanks,
Joe |
|
| Back to top |
|
 |
Mikhail Matveev Posted via mailing list.
|
Posted: Mon Sep 15, 2008 11:32 am Post subject: PHP Style (Editor warning) question |
|
|
Hi Joe,
It seems reasonable to have such a feature. I filed an issue: http://www.netbeans.org/issues/show_bug.cgi?id=147259
Thanks for your feedback.
Misha
areeda wrote:
| Quote: | My issue is with a statement like:
Code:
while($f = mysql_fetch_assoc($res))
It rightfully gives a warning about a possible accidental assignment.
In previous version of NB in PHP and Java this warning could be avoided by explicitly testing the result like
Code:
while (($f = mysql_fetch_assoc($res)) != NULL)
But no longer (I'm using fairly recent nightly builds).
I cannot think of a way to do this without duplicating the assignment statement and risk having them be different, sometimes they are a lot more complicated.
How are others dealing with this warning. I do know I can turn that off but it's saved me more than once from using A=B when I meant A==B.
Thanks,
Joe
|
|
|
| Back to top |
|
 |
areeda
Joined: 28 Aug 2008 Posts: 469 Location: Los Angeles
|
Posted: Mon Sep 15, 2008 1:43 pm Post subject: |
|
|
| Thanks Misha! |
|
| Back to top |
|
 |
nvarun
Joined: 27 Aug 2008 Posts: 170 Location: India
|
Posted: Mon Sep 15, 2008 2:26 pm Post subject: PHP Style (Editor warning) question |
|
|
On Mon, Sep 15, 2008 at 7:13 PM, areeda <address-removed ([email]address-removed[/email])> wrote:
I have voted for this issue as well.
--
Varun Nischal
http://nbguru.wordpress.com/
http://dzone.com/mvbs
"You must do the things you think you cannot do." |
|
| Back to top |
|
 |
areeda
Joined: 28 Aug 2008 Posts: 469 Location: Los Angeles
|
Posted: Mon Sep 15, 2008 6:25 pm Post subject: Re: PHP Style (Editor warning) question |
|
|
| nvarun wrote: | On Mon, Sep 15, 2008 at 7:13 PM,
I have voted for this issue as well.
Varun Nischal
|
Wow this works.!?! Who've thought? Maybe, I have too much experience with Microsoft products?
How about another PHP Editor issue?
I think formatting for a single statement if-statement (no curly braces) should be formatted with an indent like:
| Code: | if (a==b)
print "<b>cool<b>"; |
whereas the editor thinks it should be formatted
| Code: | if (a==b)
print "not as cool"; |
I do not see an option in formatting for this.
This one is not a big deal as it doesn't seem like we can put a break point at the success statement without the curly braces anyway.
Joe |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|