Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans: PHP Syntax Checking

According to a poll here on StackOverflow, NetBeans is the best PHP IDE available. This is all fine and good, except for one thing: It appears to be terrible at checking syntax. I'm sure I must be doing something wrong?

I've previously used phpDesigner, which is a great program, but I've only got version 2007, and it doesn't support xDebug (I'd have to buy the new version if I wanted that). So I thought I'd try the much vaunted (and free) NetBeans.

But, as far as I can tell, it's syntax checking is horrible. For example: Note how the same file is handled by the two different IDEs.

First phpDesigner:

phpDesigner

Pretty obvious where the problem is, right?

Then NetBeans:

NetBeans

Here there is nothing but a vague error message at the very bottom of the class, and it's not even near the function causing the error(!).

So my question is: Is it possible to get better syntax checking in NetBeans? I'm presuming there must be a way, and I'm just being really dumb.

Additionally: If this is not possible in NetBeans, what other free IDEs are available that do have this level of syntax checking?

Thanks for any help.


Some people have suggested Eclipse as a replacement, so I thought I'd test it.

Eclipse

It too correctly recognises the syntax error. (Makes me wonder if NetBeans is bugged.) I may just switch to Eclipse. Are there any other IDEs people think are worth trying?

like image 591
Chuck Le Butt Avatar asked Apr 12 '11 14:04

Chuck Le Butt


People also ask

Can PHP be used in NetBeans?

The PHP Editor in NetBeans IDE 6.9-7.0 supports all standard features such as code completion, syntax highlighting, mark occurrences, refactoring, code templates, documentation pop-up, code navigation, editor warnings and task list.

What is NetBeans PHP?

Apache NetBeans provides editors, wizards, and templates to help you create applications in Java, PHP and many other languages. Cross Platform. Apache NetBeans can be installed on all operating systems that support Java, i.e, Windows, Linux, Mac OSX and BSD. Write Once, Run Anywhere, applies to NetBeans too.


2 Answers

Well it turns out that it's a bug in NetBeans. Here's the details of the bug:

http://netbeans.org/bugzilla/show_bug.cgi?id=168350

Update: It's been fixed in NetBeans 7.0.

like image 157
Chuck Le Butt Avatar answered Oct 10 '22 21:10

Chuck Le Butt


I don't now much about NetBeans but why don't you try Eclipse with PDT? It has better syntax checking as NetBeans. Using the example presented in your post Eclipse will display the same error message as PHPDesigner (and in the right place). Give it a try. Personally, I use (and love) VIM as an IDE, but at work we have to work with Eclipse and I think it will suits your needs.

like image 30
sica07 Avatar answered Oct 10 '22 20:10

sica07