4
votes

I'm using Eclipse 3.6 (Helios) with PDT 2.2, and I'm getting syntax errors when trying to "use" namespaces.

Is there something I can do to fix this?

Example:

use Tables\Exceptions\Exception as Exception;

The PHP Parser recognizes "Tables" as a syntax error on this line and others like it.

1

1 Answers

8
votes

This is probably related to your interpreter settings in Eclipse.

Go to the Project menu and select Properties. Once you have the Properties screen up you can go to PHP Interpreter and adjust the PHP Version, either at the project level or the Workspace level.

Set the PHP Version to 5.3 or higher for proper highlighting.

If your project is in PHP 5.2 than you won't be able to use namespaces. See here: Namespaces in php 5.2